繁体   English   中英

剑道网格编辑单元不起作用

[英]Kendo-grid editCell not working

我有一个剑道网格,我想在其中打开一个单元格进行编辑。 关键是根据行的给定索引打开某个单元格。 我在我的应用程序的另一个页面中得到了这样的代码,它可以完美地运行,但是在这个网格中它拒绝打开编辑模式。 我已经在 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));

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM