View Full Version : CellEditing and validateedit event. Set incorrect value.

6 Apr 2012, 5:22 AM
If have a grid with time columns. There is startTime and EndTime fields.

User can set time in CellEditor timefield. When user ends editing, I need to check dates: Max time between startDate and endDate is 12 hours. If it is more 12 hours, editor need to return old value.

Here is editing plugin listener:

validateedit: function (editor,e) {
if (e.field == "EndDate" || e.field == "StartDate"){
var temp = new Date(editor.editors.items[0].getValue());
var val = e.originalValue;

if (e.field == "EndDate"){ var start = e.record.get("StartDate");
var end = val;
} else {
var start = val;
var end = e.record.get("EndDate");

var check = App.getController("TimeLine").checkMaxTime(false,start,end);

e.cancel = true;

if (check){


And at first time validation is correct. It return old value. But then I want to edit some another record in grid. And when I done with it, incorrect value from last editor (that was incorrect) will set in store.?? How? How to fix?

P.S. In my code in that event e.originalValue and e.value is SAME... It is unclear why...

6 Apr 2012, 7:46 AM
If you are using 4.1.0 you can try an override: