I have a grid with a combobox editor. I want to filter the combobox store according to a value in the row's record.
What I got now is this:
editor: {
xtype: 'combo',
forceSelection: true,
store: 'ship.Transportmodes',
displayField: 'name',
valueField: 'id',
queryMode: 'local',
listeners: {
expand: function(combo){
var shipper = combo.up('grid').editingPlugin.activeRecord.get('shipper');
combo.store.filterBy(function(record){
console.log(record.get('shippers').indexOf(shipper))
return record.get('shippers').indexOf(shipper) != -1
})
}
},
editable: false
}},
This is working, but there is a problem: when the dropdown is showing on the top of the field, the remaining options appear far from the field, the space for the removed options is still allotted.
I tried to filter the store on any of these events:
- grid : beforeedit
- combo : beforerender
- combo : render
- combo : afterrender
In each case the result is the following: The store gets filtered correctly, but at the time the combobox is expanded, the filter is cleared.
I would like to understand what happens. Why does a combobox always clear the filters of its store before displaying the list of options ?
Can anybody give an insight behind the scenes ? Or tell me what I'm missing in the picture ?
clearFilterOnBlur:false
so that the filter isn't cleared. – Alexander