sorry for the late reply, but you need to fire cascade manually at the
end of the delegate and you can simplify your options, though I'd
consider using $.data for this kind of thing:
var defaultOpts = {
ajax: {url: ‘otherData.js' },
template: commonTemplate,
match: commonMatch,
event: state.changed
};
var OR = $.extend({},defaultOpts,{ ajax: {url: ‘orData.js' } });
var WA = $.extend({},defaultOpts,{ ajax: {url: ‘wasData.js' } });
//THen in your delegate:
jQuery(.container-2 select).each(function() {
var child = jQuery(this);
child.parents
(.container-2:first).siblings(.container-1).find
(select).each(function() {
//below I want to compare the verable to the different options I have
above
if(currentState ==
'OR'){
child.cascade(jQuery
(this),OR);
}
if(currentState ==
'WA'){
child.cascade(jQuery
(this),WA);
}
else{
child.cascade(jQuery
(this),opts);
}
});
child.trigger(state.changed);
});
On Apr 17, 12:04 pm, Chrisw chris.p.wel...@gmail.com wrote:
I forgot to say what my issue is. It dose load anything if I remove
the if statments it works fine.
On Apr 17, 11:50 am, Chrisw chris.p.wel...@gmail.com wrote:
I am new to jquery and I need to make a form that allows a user to
select a state and a city that they go to school in. I am using
thecascadejuqery plug-in (http://plugins.jquery.com/project/cascade.
Which I think is a greatplugin) The problem is there is a lot of data
and it takes a long time for it all to load (some 28,000 records).
What I want to do is split it up into different files and then load
only the file that contains the data for that start/region. A sample
of my code is blow:
My html:
div class=container-1
label for=rsvp_stateState/label
select id=rsvp_state
option value=Pick a
State/option
option value=OROregon/option
option
value=WAWashington/option
option
value=CACalifornia/option
/select
/div
div class=container-2
label for=rsvp_cityPick a City/label
select id=rsvp_city
/select
/div
//below are the different loads that contain different data based on
the state
var OR = {
ajax: {url: ‘orData.js' },
template: commonTemplate,
match: commonMatch
};
var WA = {
ajax: {url: ‘waData.js' },
template: commonTemplate,
match: commonMatch
};
var opts = {
ajax: {url: ‘otherData.js'
},
template: commonTemplate,
match: commonMatch
};
$(document).ready(function() {
var currentState;
// #rsvp_state refers to a dropdown menu that contains all the states
//what I want to do with this is determine what state is currently //
selected and store that in a variable
$('#rsvp_state').change(function(){currentState = $
('#rsvp_state').val();});
jQuery(.container-2
select).each(function() {
var child = jQuery(this);
child.parents(.container-2:first).siblings(.container-1).find
(select).each(function() {
//below I want to compare the verable to the different options I have
above
if(currentState == 'OR'){