Hi,
My title isn't very explicit, what I'm looking for is the best way to load a datastore, load a combobox, and when both are loaded, set the combobox value with a datastore data.
I think it's something that people should do everyday here, and my way works, but has a little bug.
What I do is like that :
- I create a function for the datastore event "load"
- In that function, I put a combobox datastore listener on the "load" event too
- In the combobox function, I set the value with the datastore value (I thought both ds would be loaded here)
- I load the combobox in the datastore on load event
Looks like this :
Code:
var datastore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url: some_url }),
reader: new Ext.data.JsonReader({}, [fields_here]),
remoteSort: true
});
datastore.on('load', function(store){
var data = datastore.getAt(0).data;
cboDs.on('load', function(){
cbo.setValue(data.my_value);
});
cboDs.load();
});
When I'm opening tabs with this code, some times everything works, but other times I juste got the Id's in my combo box values because it hasn't been loaded.
If someone knows a way to do that better, I would be glad 
Thank you,
pouniok.