PDA

View Full Version : [CLOSED]Store load after field is set


ktoole
02-18-2010, 02:00 PM
We have this bit of code. The reload of the store depends on the value of add_BNCMP. What happens is that the value of add_BNCMP is set, the store starts to load, but the javascript keeps going and sets the value of add_BNLOC before the store for the combo box finishes loading. This causes the combo box to display the value instead of the text that we want. The combo box works otherwise (on first load). Is there any way to tell the code to stop when reloading the store here?

Ext.getCmp('add_BNCMP').setValue(data.BNCMP);

Ext.getCmp('add_BNLOC').clearValue();
Ext.getCmp('add_BNLOC').getStore().reload();
Ext.getCmp('add_BNLOC').reset();

Ext.getCmp('add_BNLOC').setValue(data.BNLOC);
// Ext.getCmp('add_BNLOC').setValue(null);

sean.lanktree
02-19-2010, 08:15 AM
I think putting a "load" listener on your data store will get you what you want....


var myStore = new Ext.data.JsonStore({
root: 'data',
listeners: {
load: function(){
// insert your code here
}
}
})

ktoole
02-19-2010, 10:59 AM
I had tried that, but had problems getting the value to work with the add_BNLOC field coming in. After you mentioned this, I tried it with the temporary field to hold the value from the input data. That worked! Thanks.