14 May 2013 12:00 PM #1
Answered: ExtJS 4.2 Nested data with cascading combobox issue
I have nested data from json loaded into a single store based on a Parent model. The Parent model hasMany child model, which in turn has it's own hasMany child model.
It's kinda working - I'm still having trouble accessing the last tier w/o resorting to getAssociatedData from the top tier (.state() works, but .cities() doesn't).....anywho..that's another issue for later)
I set things up this way b/c I didn't want to send multiple requests for related data, esp now that we're using ExtJS 4.x which handles model associations!
I use 2 comboboxes (cascading) for the 2nd and 3rd tier data. On the first combobox, I have a listener handler creating/assigning a store to the second combobox after doing a lookup (the getAssociatedData() call I mentioned above) against my model based on the value chosen in the first combobox. I can make a selection there, and see it's children values used as records in the 2nd combobox list.
works great so far!
Issue: when I change the selection on the 1st combobox, I can see that the 2nd combobox store data is retrieved correctly (via chrome/firebug), but I'm having trouble getting this new info to display in the 2nd combobox (it only displays previous data set).
(Question: Is there a better way for already loaded local data? Since I create/assign w/ each select action on the 1st combobox, I'm worried about memory and orphaned objects each time the user changes their selection.)
PS - I had things working fine in 4.1.x after some research (fix was to clear store filters and delete the lastQuery property). Since then, I've upgraded to 4.2 and am also now using a single model w/ hasMany associations. Current issue looks exactly like the caching issue I had when I started in 4.1, but now my fix no longer works in 4.2. I did notice the combobox store.filter but it isn't behaving as I'd expect (does it apply to local data?)...looking for insight..help!!
thanks in advance!
Last edited by rtirbany; 14 May 2013 at 6:03 PM. Reason: clean up
So in the first combo, you get the record when one is selected and you execute the getter which returns a data Store and are binding it to the 2nd combo?
16 May 2013 5:04 AM #2
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
So in the first combo, you get the record when one is selected and you execute the getter which returns a data Store and are binding it to the 2nd combo?Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Software Engineer
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.
18 May 2013 6:34 PM #3
hey man, just wanted to say thanks again for the tip. Right after you mentioned binding, I couldn't believe that I hadn't attempted it earlier...Great meeting you the other night, hope you enjoyed your trip out this way and see you in Orlando!