我有一个剑道网格,我想在其中打开一个单元格进行编辑。要点是根据行的给定索引打开某个单元格。我在应用程序的另一个页面中得到了这样的代码,它工作得很好,但是在这个网格中它拒绝打开编辑模式。我也在 Telerik dojo 中尝试过这一点,它也按预期工作。
注意:在我的另一个网格中,代码运行良好,索引需要+1才能编辑(而不是选择),但是当我在这里尝试相同的操作时,它不起作用。
代码:
var gridloc = $("#ItemLocGrid").data("kendoGrid");
var dataloc = $("#ItemLocGrid").data("kendoGrid").dataSource;
var alldataloc = gridloc.dataSource.data();
$.each(alldataloc, function (index, item) {
if (item.Barcode == code) {
item.PickedStock++;
item.dirty = true;
console.log(index);
//This works for selecting the right row or the right cell(row 0)
gridloc.select("tr:eq(" + (index) + ")");
gridloc.select("td:eq(" + (2) + ")");
//This works
gridloc.select("tr:eq("+(1)+") td:eq("+ (2) +")");
//This works (but only for row index 0)
gridloc.editCell(gridloc.tbody.find("td").eq(2));
//This doesn't work (should do exactly the same as the line above)
gridloc.editCell("td:eq(" + (2) + ")");
//This is the wanted code which worked in a different grid and dojo
gridloc.editCell("tr:eq("+(index)+")td:eq("+(2)+")");
}
})
最佳答案
你能试试这个吗:
//This doesn't work (should do exactly the same as the line above)
gridloc.editCell("td:eq(" + (2) + ")");
没有括号?
//This doesn't work (should do exactly the same as the line above)
gridloc.editCell("td:eq(" + 2 + ")");
关于javascript - Kendo-grid editCell 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46641308/