Reputation: 370
I tried using various code snippets for implementing this particular functionality of creating a new row when you press enter key WHILE YOU ARE EDITING in a particular cell.
`$(document).on('keypress','body',function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '13'){
grid.addRow();
}
});
The above code worked when you simply press enter key, but when you're editing a cell and pressing enter key, it did not create a new row.
I want to create a new row when you press enter key while editing a particular cell.
It would be really great if someone can help me regarding this.
Thanks in advance. Here's the js fiddle.
In short:- If i am editing in a particular cell, when i press the enter key, it should create a new row!
Upvotes: 3
Views: 1024
Reputation: 370
It worked when I replaced "body" with "#stocks_tbl" and "keypress" with "keyup"!
$(document).on('keyup','#stocks_tbl',function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '13'){
var grid = $("#stocks_tbl").data("kendoGrid");
grid.addRow();
}
});
' #Kendo UI '
Upvotes: 3