[英]Karma + AngularJS + Kendo: Kendo-grid testing is not working
[英]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.