我使用下面的代码来获取所选代码,但我需要获取当前行索引向上移动abd,如何获得selecetd的行索引项目: 我的代码:
$("#btnup").click(function () {
var grid = $("#grid").data("kendoGrid");
var selectedItem = grid.dataItem(grid.select());
if (selectedItem != undefined) {
alert("The Row Is SELECTED");
// here need row index
}
else
alert("NO Row Is SELECTED")
});
答案 0 :(得分:4)
请尝试使用以下代码段。
$("#btnup").click(function () {
var grid = $("#grid").data("kendoGrid");
var selectedItem = grid.dataItem(grid.select());
if (selectedItem != undefined) {
// I have added selected row index on below code line
alert("The Row Is SELECTED at index: " + grid.select().index());
}
else
alert("NO Row Is SELECTED")
});
如果有任何疑虑,请告诉我。