PDA

View Full Version : Filtering editor grid combo doesn't work on first edit



csky
13 Oct 2009, 6:39 PM
I have an editor grid and want to filter combo options based upon the value of another grid column. The following code snippet works, but not on the very first edit. This seems like the most appropriate event to trigger on.

This can be added to examples/grid/edit-grid.js and will filter options not starting with "most".



grid.on('beforeedit', function(e)
{
if (e.field != 'light')
return;

var ce = e.grid.getColumnModel().getCellEditor(e.column, e.row).field;

var common = e.record.get('common');
var store = ce.getStore();

if (common == "filter")
store.filter('text', /Most/ );
else
store.clearFilter();
});


Any suggestions would be appreciated.