View Full Version : Validation on numberic field of EditorGridPanel

28 Nov 2011, 1:52 AM
I am new to the Ext JS.I want to implement the following:
Using the EditorGridPanel.There are 2 columns in the grid : Percentage margin 1 and Percentage margin 2.Both are allowed to be editable.While editing Percentage margin 1, i want to check if the value entered is less than Percentage margin 2, then I want to reject the changes.
Basically, want to apply a validation that Percentage margin 1 is never less than Percentage margin 2.

Thanks in advance.

28 Nov 2011, 3:53 AM

has the event:

validateedit( Object e )
Fires after a cell is edited, but before the value is set in the record. Return false to cancel the change. 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 being set
originalValue - The original value for the field, before the edit.
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.
Usage example showing how to remove the red triangle (dirty record indicator) from some records (not all). By observing the grid's validateedit event, it can be cancelled if the edit occurs on a targeted row (for example) and then setting the field's new value in the Record directly:

grid.on('validateedit', function(e) {
var myTargetRow = 6;

if (e.row == myTargetRow) {
e.cancel = true;
e.record.data[e.field] = e.value;
e : Object
An edit event (see above for description)

since you get the record (all data of a row), it should be no problem to compare fields.