I am using in-line editing of data in the kendo grid. When I am editing a cell I want to do the following:
- Press Enter should commit the cell value and close the edit.
- Press Tab should commit the cell value and move to the next cell.
- Press Escape should cancel the cell change (and revert the value) and stop editing.
At the minute I've tried the following from bits online:
01.
$(
function
() {
02.
03.
$(
"#mygrid"
).keypress(
function
(e) {
04.
05.
var
keyCode = e.keyCode || e.which;
06.
if
(keyCode == 13) {
07.
debugger;
08.
var
grid = $(
"#mygrid"
).data(
"kendoGrid"
);
09.
var
curCell = grid.table.find(
".k-edit-cell"
);
10.
grid.saveRow();
11.
grid.editCell(curCell.next());
// To move the cursor to the next cell and put the cell in edit mode
12.
grid.select(curCell.next());
// To select the next cell
13.
//grid.focus(curCell.next()); // To set focus on to next cell
14.
e.preventDefault();
// To prevent the default behavior of the enter key press
15.
}
16.
});
17.
});
I cannot see any method on how to accept the grid cell changes.
Any help on how to accomplish the above greatly appreciated.
Andez