View Full Version : Grid cell auto update on inline dit or another cell

23 Apr 2007, 3:34 AM
Hi guys,

I am trying to use a Grid inline editing feature to edit a large dataset. The data set hasfew columns which is related to other columns.

Basically it means, if I inline edit a cell in a row, some other cells in the same row would be auto updated based on the inline dited value.

For example, I have "Due Date" and "Status" field. Base on the due date, the status would either be "Expired", "1 week to go", "3 days to go", and so on.

Can I do this with the Grid and inline editor? Is there any example to do this?

I'm just guessing here, on row selection I would be able to get the row ID and so I obtain the Record of that record. But how do I auto update the elements in the Record?

Definitely need some guidance here.

24 Apr 2007, 9:18 AM
I have a similar requirement and achieve it by adding a validateedit event handler to the grid, When the edit occurs my handler receives an event object that has a record property (for the row currently edited). You can check the edited cell value and then update the dependent cell via the set method (from Ext.data.Record).

grid.on( "validateedit", function( e ){
if( e.field == "status" && e.value == "Completed" ){
e.record.set( 'completedDate', today );
});Whats nice about this is the updated dependent cell is flagged as edited and can be reset if necessary by a call to ds.rejectChanges. If you don't want that you could access the data array of the Record object directly