This is oldish code but anyway…
I am trying to filter a store, and listen to the event in a comboBox, so I can refresh it.
My doQuery event didnt work, ( well actually it did work, but returned random result sets, leaving an overall wtf feeling )
config.store.filterBy(function Filter(record){
//this works
if (record.data.field != ""){
return true;
}
else {return false;}
});
However this does not automagically update the combobox.
So I tried various versions of
cbx = new Ext.getCmp(this);
debugger; //scope right here
this.getStore().on("datachanged",function refresh(){
cbx.reset();// store's scope
});
But the scope of cbx always seems to be the store, instead of the combobox.
Anyone have any a clue how to do add said a listener for the data change event in a store to a comboBox?
The default scope of an event callback is the object that triggered the event. In this case that would be the store. The third parameter of the method on() allows you to override the scope. Set the third parameter to
thisand your good to go.From the documentation (3.x and 4.x):
So something like this should do the trick: