Kendo dataSource.add - Type Error: o is undefined

Kendo dataSource.add - Type Error: o is undefined

我正在尝试向我的 Kendo DataSource 添加一个项目,但每当我尝试添加时,我总是收到以下错误:

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  });
}
});

在过去的几个小时里,我一直在试图找出导致此错误的原因,但似乎无法弄清楚。

BaaIdBaaSectionIdBody 都包含值,所以我完全迷失了这个错误。

我终于解决了我的问题。

我改线了

noteList.add({ BaaId: baaId, BaaSectionId: baaSectionId, Body: body });

noteList.dataSource.add({ BaaId: baaId, BaaSectionId: baaSectionId, Body: body });