0
我试图将项目添加到我的Kendo DataSource
,但我不断收到以下错误,每当我尝试添加:剑道dataSource.add - 类型错误:o是未定义
TypeError: o is undefined - kendo.all.min.js (line 50, col 23446)
发生这种情况时,我尝试并使用dataSource.add()
方法。
sectionNotesDataSource: new kendo.data.DataSource({
transport: {
read: {
url: "/baa/baa/GetNotes",
dataType: "json",
type: "GET",
data: {
Id: $("#Id").val()
}
},
create: {
url: "/baa/baa/CreateNote",
dataType: "json",
type: "POST"
},
parameterMap: function (data, operation) {
if (operation === "update" || operation === "create") {
data.CreateDate = _dateToString(data.CreateDate);
data.LastModDate = _dateToString(data.LastModDate);
}
return data;
}
},
schema: {
model: {
id: "Id",
fields: {
Id: { type: "number", editable: false, nullable: true },
BaaId: { type: "number", editable: false, nullable: false },
BaaSectionId: { type: "number", editable: false, nullable: false },
Body: { type: "string", editable: true },
}
}
}
}),
onNewNote: function (e) {
var baaId = $(e.currentTarget).data("baaId");
var baaSectionId = $(e.currentTarget).data("baasection");
var noteList = $(e.target).closest(".baa-section-notes").find(".section-note-list").data("kendoListView");
$("#NoteSave").on("click", function() {
var body = editor.value();
noteList.add({ BaaId: baaId, BaaSectionId: baaSectionId, Body: body });
}
});
我一直在试图弄清楚过去几个小时是什么导致这个错误,但似乎无法弄清楚。
BaaId
,BaaSectionId
和Body
都包含值,所以我完全失去了这个错误。