PDA

View Full Version : filtering Combox inside Editorgrid



ekhanh101
5 May 2010, 5:16 PM
Hi,
I have a combox in an editor grid, just like this example.

http://www.extjs.com/deploy/dev/examples/grid/edit-grid.html

How do i filter the combox box based on a value from another cell, when the user clicks on the combox to edit?

the combobox store has all the data, and i want to filter it down to a smaller subset, when the user clicks on the combox on the row. the filtering is based on the same rec in the row that's being edited.

It's similar to to linked combox box.
The edited row, the user changes on value, i would like to adjust the values available in the 2nd combo box.

Thanks.

ekhanh101
6 May 2010, 12:06 PM
I figured it out. :)

had to listen to the beforeedit: in the EditorGrid pane, then find the combobox store and reload with the param.


beforeedit : function(e) {
/// the Fires before cell editing is triggered. The edit event object has the following properties
// * grid - This grid
// * record - The record being edited
// * field - The field name being edited
// * value - The value for the field being edited.
// * row - The grid row index
// * column - The grid column index
// * cancel - Set this to true to cancel the edit or return false from your handler.
if (e.field == 'combo1') {
// user wants to edit the drop down. filter the dropdown based on combo1.
Ext.getCmp('combo2').store.reload({
params: { "filter": e.record.data.filterData }
});
}
}