我正在使用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