krause
21 Sep 2009, 10:07 AM
Time and again I have stumbled for the need to clear a combo and its store so that next time you click the trigger button the values are reloaded from the server (e.g. dependent combos).
Niether the combo's reset() nor the store's removeAll() do the trick alone. You also need to clear the store's lastQuery private property.
I think that it would be very convienient that the combo had a method for doing this.
Currently I override the ComboBox as this:
/**
* Clear the combo and clear the store to force reloading of data.
*
*/
Ext.override(Ext.form.ComboBox, {
clear: function(){
this.clearValue();
if (this.mode = "remote" && this.store) {
this.getStore().removeAll();
this.lastQuery=null;
}
}
});
Niether the combo's reset() nor the store's removeAll() do the trick alone. You also need to clear the store's lastQuery private property.
I think that it would be very convienient that the combo had a method for doing this.
Currently I override the ComboBox as this:
/**
* Clear the combo and clear the store to force reloading of data.
*
*/
Ext.override(Ext.form.ComboBox, {
clear: function(){
this.clearValue();
if (this.mode = "remote" && this.store) {
this.getStore().removeAll();
this.lastQuery=null;
}
}
});