我正在使用kendo网格,并在编辑一行时检查该行是否可编辑或不可编辑。如何使选定的行不可编辑,如果它不可编辑。我正在执行网格的edit
函数的检查。防止编辑剑道网格中的一行?
代码
$("#grid").kendoGrid({
dataSource : ds,
selectable : "multiple",
sortable : true,
filterable : false,
reorderable: true,
scrollable : false,
toolbar : ["create"],
columns: [
{ field: "event", width: "120px", title: "Event Type"},
{ field: "event_id", width: "120px", title: "Event ID"},
{ field: "addr_no_or_type", width: "120px", title:"Address"},
{ field: "event_rate", width: "100px", title: "Rate"},
{ field: "sched_date", width: "100px", title: "Scheduled"},
{ field: "complete_date", width: "100px", title:"Completed"},
{ field: "serial_no", width: "100px", title: "Serial #"},
{ command: ["edit", "destroy"], title: "Options", width: "170px"}
],
editable: "inline",
edit : function(e){
selectedRowIndex = $("#grid").data("kendoGrid").select().index();
if (selectedRowIndex >= 0) {
var grid = $("#grid").data("kendoGrid");
var selectedItem = grid.dataItem(grid.select());
var slno = selectedItem.serial_no;
if(slno!=0){
grid.cancelRow();
}
}
}
});
但是当我使用这个我越来越控制台下面的错误。
Uncaught TypeError: Cannot call method 'delegate' of null
有人可以提出一种方法来解决它。谢谢。
基本上我会建议,以防止编辑使用dataBound事件,但它取决于当前的网格配置 - 请你分享网格代码? – 2013-04-09 05:51:07
我编辑了代码。你可以看它 – 2013-04-09 06:08:43
尝试谷歌搜索_KendoUI只读行_ – OnaBai 2013-04-09 07:16:42