我们正在使用 Kendo 构建一个低头数据输入应用程序,并大量使用 Kendo Grid。在网格中使用 selectable='row'
或 selectable='col'
是有问题的,因为用户不使用鼠标输入数据,而是使用 Tab 键导航网格。可视行/单元格选择器不遵循实际的事件行和单元格。
问题:如何在关闭可选择且不使用 grid.select() 的情况下获取网格中行的行索引和/或uid?
这是网格设置代码:
$("#" + target).kendoGrid({
dataSource: gridDs,
edit: gridCellEdit,
height: applet.height,
editable: {
createAt: 'bottom'
},
filterable: true,
sortable: true,
navigatable: true,
resizable: true,
reorderable: true,
scrollable: { virtual: true },
columns: gridColumns,
dataBound: monitorKeyboard
}
});
function gridCellEdit(e) {
var uid = $('#grid_active_cell').closest('tr').data('uid');
console.log(uid);
}
最佳答案
使用您手头的任何方法来解析用户当前所在的行元素,然后只需执行以下操作:
$(target-tr).data('uid');
如果我正确理解你的问题,这将是
$('#grid_active_cell').closest('tr').data('uid');
如果我理解错误,请详细说明。
关于javascript - 如何在不使用 Grid.Select() 的情况下获取 Kendo Grid 中一行的 UID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29834848/