javascript - Kendo-grid editCell 不工作

标签 javascript telerik kendo-grid

我有一个剑道网格,我想在其中打开一个单元格进行编辑。要点是根据行的给定索引打开某个单元格。我在应用程序的另一个页面中得到了这样的代码,它工作得很好,但是在这个网格中它拒绝打开编辑模式。我也在 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/

相关文章:

javascript - 动态生成的行上的 jQuery 日期选择器

javascript - 如果满足条件,如何更改 div 中每个 p 的颜色?

javascript - document.getElementById 不起作用/显示

c# - RadDateTimePicker + 用于数据输入的掩码

c# - 在按钮单击事件之前获取返回确认以触发的问题

c# - 在 Telerik mvc 网格中一键插入多条记录

javascript - Django 模板中的 List.pop() 没有 for 循环

javascript - 如何从 Kendo 网格中删除所有行

javascript - 如何删除或隐藏过滤器运算符下拉列表

javascript - 在 Kendo 数据网格中保留额外的 dataSource.read 参数