Kendo-网格 editCell 不工作
Kendo-grid editCell not working
我有一个 kendo- 网格,我想在其中打开一个单元格进行编辑。重点是根据行的给定索引打开某个单元格。我在我的应用程序的另一个页面中得到了这样的代码,它可以完美地工作但是在这个网格中它拒绝打开编辑模式。我也在 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 + ")");
出于某种原因,我尝试重新使用的相同代码在这里不起作用
gridloc.editCell("tr:eq("+(index+1)+") td:eq("+(2)+")");
然而,将它重建成这样就成功了 gridloc.editCell(gridloc.tbody.find("tr").eq(index).find("td").eq(2));
我有一个 kendo- 网格,我想在其中打开一个单元格进行编辑。重点是根据行的给定索引打开某个单元格。我在我的应用程序的另一个页面中得到了这样的代码,它可以完美地工作但是在这个网格中它拒绝打开编辑模式。我也在 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 + ")");
出于某种原因,我尝试重新使用的相同代码在这里不起作用
gridloc.editCell("tr:eq("+(index+1)+") td:eq("+(2)+")");
然而,将它重建成这样就成功了 gridloc.editCell(gridloc.tbody.find("tr").eq(index).find("td").eq(2));