Reputation: 24112
When I click on a cell to edit it, and then press enter, nothing happens.
How can I make the grid save when the enter key is pressed?
I have tried binding the keycode in the edit handler and that doesn't work.
I need it to save the contents of the cell for good usability in my app. At the moment the only way to save grid contents is by clicking off the cell.
Upvotes: 0
Views: 1572
Reputation: 1286
With inspiration from here: https://www.telerik.com/forums/save-in-cell-edits-before-calling-editcell-or-calling-close-cell I did this:
var $grid = $("#grid").kendoGrid({
...
...
cellClose: function(e) {
if (e.model.dirty) {
// call save method
}
}
}).data("kendoGrid");
// catch enter keydown and call closeCell
$grid.table.on("keydown", function(e){
if(e.keyCode === 13) {
setTimeout(function(){
$grid.closeCell();
});
}
});
Upvotes: 0
Reputation: 1889
You can try enabling the navigatable configuration option of the grid.
Upvotes: 5