当Kendo网格单元格打开进行编辑时,使用右箭头键关闭单元格(并移动到下一个单元格)的最佳方法是什么?
答案 0 :(得分:1)
查看以下代码段。这是一种做你想做的事情的简单方法:
// Bind any keyup interaction on the grid
$("#grid").on("keyup", "input", function(e)
{
// Right arrow keyCode
if (e.keyCode == 39)
{
// Ends current field edition.
// Kendo docs says that editCell method:
// "Switches the specified table cell in edit mode"
// but that doesn't happens and the current cell keeps on edit mode.
var td = $(e.target)
.trigger("blur");
// Find next field
td = td.closest("td").next();
// If no cell was found, look for the next row
if (td.length == 0)
{
td = $(e.target).closest("tr").next().find("td:first");
}
// As ways happens on kendo, a little (ugly)workaround
// for calling editCell, because calling without
// the timer doesn't seem to work.
window.setTimeout(function()
{
grid.editCell(td);
}, 1);
}
});
我不知道为什么但是我无法保存小提琴,我得到500内部错误。无论如何,它似乎达到了你所需要的。网格需要处于编辑模式incell
。