I am using a custom keydown function that works great to get enter to work as a tab in Add mode and to close and move down a row in Update mode (batch editing on the grid). However, I just realized that the enter key is closing the cell and moving down even if the cell validation fails. How do I check whether the cell is valid before moving off the cell?
Here is the portion of the keydown function that handles the enter key...
if (e.keyCode === kendo.keys.ENTER) {
currentCell = $(e.target).closest('td');
currentRow = $(e.target).closest('tr');
cellIndex = currentCell.index();
//debugger;
if (cellIndex > -1) {
grid = currentRow.closest("[data-role=grid").data("kendoGrid");
model = grid.dataItem(currentRow);
if (model.isNew()) {
e.keyCode = kendo.keys.TAB;
}
else {
//debugger;
var nextRow = currentRow.next();
if (nextRow.length) {
//debugger;
var nextCell = nextRow.find("td").eq(cellIndex);
setTimeout(function () {
grid.closeCell(currentCell);
grid.current(nextCell);
grid.editCell(nextCell[0]);
}, 50);
}
}
}
}