View Full Version : Refreshing Combo box in extjs 4

1 Nov 2012, 2:08 AM
Getting stuck on refreshing data of combo box ,
on button click trying to reload combo data by loading store -


Store is reloading but data is not reflecting on combo box.

Is there any way?

1 Nov 2012, 4:31 AM
Loading the store should be sufficient. Are you sure that you're loading the correct store?

Could you post the config for your combobox?

1 Nov 2012, 5:35 AM
here is my code for combo

1 Nov 2012, 9:26 AM
From what you've posted my best guess is that the store you're loading isn't the same one used by your combobox.



Are you explicitly adding the storeId to that store or are you relying on the MVC magic to add it? If it's the latter then that would go some way to explaining how you're getting into this mess.

1 Nov 2012, 11:18 PM
Hi skirtle (http://www.sencha.com/forum/member.php?197255-skirtle),

I'm using MVC Format and itried -

callback: function() {
It work.. but in extjs 4 dock don't have bindStore(store) method.

2 Nov 2012, 6:29 AM
"store:Ext.create(...)" is not an MVC-app approach, but "store:'test'" is. However, you will need to either require that store in component definition, or specify its name in stores array of controller.

3 Nov 2012, 12:49 AM
@rhytha268. I have no idea why you're rebinding the store like that but it's almost certainly not correct.

Back to your original problem...

My theory is that you have two stores that are instances of ASA.store.test. One you are passing to the combobox in its config. The other is created elsewhere (possibly by the MVC's auto-creation of stores) and is being given the storeId of 'test'.

By default a store doesn't have an id but any stores created by the MVC will be given an id equal to their classname, so in this case 'test'. Looking up a store using Ext.StoreManager.lookup('test') is looking for a store based on id.

As ettavolt has said, if the store 'test' is being created elsewhere then you can just pass the string id in the combobox config rather than creating a new store inline. However, you should be aware that this store is a single, shared instance of that store class so you need to be careful not to use it in multiple places that are expecting independent stores.