-
19 Jun 2012 7:37 AM #1
Answered: Nested Combobox
Answered: Nested Combobox
Hi all, i am try to implement a nested Combobox with extjs4 i have all right i think, but the problem is in my function when i try to load my store in the combo here is my error:
records.get is not a function
And here is mi code in my Controller:
Thanks..Code:onComboboxSelect: function(combo, records, options) { var form = Ext.getCmp('state'); console.info(form); var store = form.getStore(); form.enable(); form.clearValue(); store.load({params:{id: records.get('value')}}); }
-
Best Answer Posted by scottmartinYou can just use store.load()what about reload in extjs4?
Scott.
-
19 Jun 2012 10:07 AM #2Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
Have you evaluated records to see if the object is valid? What are you using to debug?
Scott.
-
19 Jun 2012 10:35 AM #3
-
19 Jun 2012 10:41 AM #4Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
records is array .. please try the following:
Scott.Code:// The data store containing the list of states var states = Ext.create('Ext.data.Store', { fields: ['abbr', 'name'], data : [ {"abbr":"AL", "name":"Alabama"}, {"abbr":"AK", "name":"Alaska"}, {"abbr":"AZ", "name":"Arizona"} //... ] }); // Create the combo box, attached to the states data store Ext.create('Ext.form.ComboBox', { fieldLabel: 'Choose State', store: states, queryMode: 'local', displayField: 'name', valueField: 'abbr', renderTo: Ext.getBody(), listeners: { select: function(combo,records,opts) { console.log(records.data.name); } } });
-
19 Jun 2012 12:23 PM #5
mmm but the question is how can reload the store for can load my state from my id who give me my country?
i try form.getStore().load({params:{'id': comb.getValue('value')
but is show me the countrys not the states
12.jpg
-
19 Jun 2012 12:49 PM #6Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
Your original problem of records.get('value') has been solved?
Now the issue is loading the secondary combo?
When you make the call using store, is the correct information sent to the server and returned from the server?
Scott.
-
19 Jun 2012 1:32 PM #7
I think i solve with store.load({params :{id: comb.getValue()
}});
Because i send my id from my function.for my php resolve the state with the id of the country, but i have a problem i think the store is not reload because is sending the same store only the countrysid 1 limit 25 page 1 start 0
{"total":5,"data":[{"value":0,"label":"Argentina"},{"value":1,"label":"Espa\u00f1a"},
{"value":2,"label":"M\u00e9xico"},{"value":3,"label":"Per\u00fa"},
{"value":4,"label":"United States"}]}
what about reload in extjs4?
-
19 Jun 2012 2:05 PM #8Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
You can just use store.load()what about reload in extjs4?
Scott.
-
20 Jun 2012 5:09 AM #9
-
20 Jun 2012 5:28 AM #10Sencha - Support Team
- Join Date
- Jul 2010
- Location
- Houston, Tx
- Posts
- 7,185
- Vote Rating
- 194
- Answers
- 433
Only the store you provide should load again
Does each combo have it's own store?
Is there any events that would cause the country store to load after a change of states store?
Scott.


Reply With Quote