Reputation: 31
Trying to get the previous value of the combo box. I tried 'change' event, but it does not work. 'beforeselect' does not exist for the new extjs 4.0 if i am not wrong. Any ideas on how i can do this?
I understand we can use the change event, but that only happens when the user types something. I want to check if there is an previous value on each new select?
Upvotes: 3
Views: 5567
Reputation: 567
You can also get the previous value of the combo from valueModels of the combo object in beforeselect event.
beforeselect: function(combo, record, index, eOpts){
me.prevCountry = combo.valueModels[0].data.COUNTRY_ID;
}
Upvotes: 3
Reputation: 1916
you can use change event handler that pass this params to your listener ( combo, newValue, oldValue )
Upvotes: 1
Reputation: 22386
It's kind of weird that there is no beforeselect
event. However, combobox
extends picker
and every picker has selectionModel with beforeselect
event. So you may assign handler to picker selModel's beforeselect
event:
MyCombo.getPicker().getSelectionModel()
.on('beforeselect',function(sm, selections, i) {
console.log(sm.lastSelected, selections, i);
});
Upvotes: 4