gpt4 book ai didi

kendo-ui - Kendo Grid 显示错误 "Uncaught TypeError: Cannot read property ' 模板'未定义“

转载 作者:行者123 更新时间:2023-12-01 19:17:35 25 4
gpt4 key购买 nike

未捕获类型错误:无法读取未定义的属性"template"

我正在使用剑道网格。

我想在编辑时禁用列。(不是在添加新记录时禁用)。编辑时是否编写了代码

function onEdit(e) {
var indexCell = 1;
var grid = $('#consumablesGrid').data('kendoGrid');


if (e.model.id) { // when Editing the id is defined
if (indexCell != 'undefined' && grid.columns[indexCell].title == "Consumable") {
grid.closeCell();
}
}
}

但执行 grid.closeCell() 时显示 “Uncaught TypeError: Cannot read property 'template' of undefined "

为了更好地理解,我包括了我的完整网格条件。

function ConsumableManager() {
$("#consumablesGrid").kendoGrid({
dataSource: {

transport: {
read: {
url: "GetConsumablesGrid",
type: "POST",
contentType: "application/json",
dataType: "json"
},

update: {
url: "UpdateConsumables",
contentType: "application/json",
type: "POST",
dataType: "json",
complete: function (data) {
var result = jQuery.parseJSON(data.responseText);

if (result.State == true) {
toastr.success(result.Description);
$("#consumablesGrid").data("kendoGrid").dataSource.read();
}
else {
toastr.error(result.Description);
$("#consumablesGrid").data("kendoGrid").dataSource.read();
}
}

},
destroy: {
url: "DestroyConsumables",
contentType: "application/json",
type: "POST",
dataType: "json",
complete: function (data) {
var result = jQuery.parseJSON(data.responseText);

if (result.State == true) {
toastr.success(result.Description);
$("#consumablesGrid").data("kendoGrid").dataSource.read();
}
else {
toastr.error(result.Description);
}
}
},
create: {
url: "CreateConsumables",
contentType: "application/json",
type: "POST",
dataType: "json",
complete: function (data) {
var result = jQuery.parseJSON(data.responseText);

if (result.State == true) {
toastr.success(result.Description);
$("#consumablesGrid").data("kendoGrid").dataSource.read();
}
else {
toastr.error(result.Description);
}
}
},
parameterMap: function (data, operation) {
if (operation != "read") {
return kendo.stringify(data.models);
}

}
},

serverPaging: false,
pageSize: 10,
batch: true,

schema: {
model: {
id: "ConsumablesID",
fields: {
ConsumablesID: { editable: false },
Consumable: { editable: true },
UnitCost: { editable: true },
Currency: { editable: true },
ContractID: { editable: false }
}
},
errors: "Errors"
},

error: function (e) {
alert(e.errors + "grid");
}
},
editable:
{
mode: "inline",
createAt: "bottom"
},
pageable: {
refresh: true,
pageSizes: true
},
toolbar: ["create"],
sortable: true,
autoBind: false,

edit: function (e) {
alert("Edit");
onEdit(e);
},
update: function (e) {

},
columns:
[

{ field: "ConsumablesID", width: 50, hidden: true, title: "ID" },
{ field: "Consumable", width: 200, title: "Consumable", editor: ConsumablesDropDownEditor },
{ field: "UnitCost", width: 100, title: "Unit Cost" },
{ field: "Currency", width: 200, title: "Currency", editor: CurrencyUnitDropDownEditor },
{ field: "ContractID", width: 85, hidden: true, title: "ContractID" },

{ command: ["edit", "destroy"], title: "Action", width: "175px" }
]
});


$("#consumablesGrid").data("kendoGrid").dataSource.read();
}

任何人都知道为什么会发生这种情况。我该怎么做,请回复。

1.我有一个网格

2.我想在编辑时可编辑(False)(不在添加中)

最佳答案

关于kendo-ui - Kendo Grid 显示错误 "Uncaught TypeError: Cannot read property ' 模板'未定义“,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23364990/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com