It's been about 2 weeks so I thought I would *bump* this. Anyone? There's gotta be a way, no?
Thanks in advance if anyone can help me with this. Cheers! On Feb 6, 12:28 am, James <james.tilb...@gmail.com> wrote: > @Mike > Hi again! > > I'm "almost" getting it. I guess what I'm trying to do is use nested > arrays within the JSON structure and maybe jQuery can't handle it? > > I've restructured the JSON file to be: > > { > "Country1": { > "Region1": [ > "Citya1", > "Citya2", > "Citya3" > ], > "Region2": [ > "Cityb1", > "Cityb2", > "Cityb3" > ] > } > > } > > It's basically a nested array. I'm trying to get the (chained)cascadeplugin > to simply read in the text on each first level of the > array (ie. the second dropdown box will be populated with all the > "Region#" in the array since the match found in the selectedValue > would equal "Country1". > > Then the same function should automatically populate the 3rd dropdown > will the related City# -> ie. if Region1 is selected (as would be the > default in this case), the third dropdown would be populated with all > the Citya# texts. > > Does this make sense? > > Am what I am trying to do even possible with jQuery's handling of > JSON? > > Firebug does tell me that the object has been read correctly and is an > array structure Country1.Region1.City1 (etc)... > > If you could point me to just a little more help I think I can get > this! :) > > Thanks, > James > > On Feb 4, 3:58 pm, Mike Nichols <nichols.mik...@gmail.com> wrote: > > > sorry i replied on your other thread: > > > @james, > > There is not a fixed schema for items incascade. The json structure > > is outside the scope ofcascade. For smaller lists I might load some > > javascript when the page hits and assign the 'url' as the var I gave > > it. For larger lists or more complex objects I might just have an ajax > > call for each list change event. It just depends. In either case, you > > are simply dealing with individual items that simply need to answer > > the predicate found in your 'match' option implementation as to > > whether they should be hydrated into the child list or not. > > Hope this helps > > mike > > > On Feb 3, 9:15 am, James <james.tilb...@gmail.com> wrote: > > > > Mike et all: > > > > Now that I've worked through some of the basics, I would like to know > > > how easy it would be to accommodate a JSON file in a bit of a more > > > efficient structure using arrays rather than simple value pairs. > > > > IE.: You have designed around this structure: > > > {'when':'selectedValue','value':'itemValue','text':'itemText'} > > > > Whereas after some testing, I've realized the data sizes would become > > > rather huge rather quickly. > > > > I'm proposing a JSON structure such as: > > > > { > > > "Country1": [ > > > { > > > "Region1": [ > > > "City1", > > > "City2", > > > "City3" > > > ], > > > "Region2": [ > > > "City1", > > > "City2", > > > "City3" > > > ] > > > } > > > ] > > > > } > > > > The idea would be for a separate JSON file for each country (now that > > > we've got dynamic URLs working). (see related discussion: [url]http:// > > > groups.google.com/group/jquery-en/browse_thread/thread/ > > > 142c1e9e9119b198#[/url] > > > > Of course this simplified structure would require some parsing and > > > reformatting AFTER loading the JSON file to fit the structure used for > > > the .CASCADEplugin. > > > > My problem is, since I'm so new to all this, I have no idea where in > > > the code to begin looking at how to take my imported JSON file, and > > > then do the work on it to change it into your format. > > > > Could you offer some insight on this? > > > > Thanks, > > > James