I am using the kendo ui grid and am trying to add CRUD operations for my model that has some navigation properties. Here is my schema:
And here is my grid:
When I hit the "Add New Record Button" in the kendo grid, I get the following error:Uncaught TypeError: Cannot read property 'Comments' of undefined(anonymous function). Now here is the thing. I manually added a row to my SQL table, and I can use the kendo grid to UPDATE the row successfully. I can edit the navigation property "Comments".
But for some reason, when I create a new row, I cannot get it to work.My guess is that when I load the table it loads the navigation properties, but when I hit "Add New Record", it doesn't know how to create the navigation property "From scratch", whereas when I update a row it already has the navigation property info loaded.Any ideas how I would go about fixing this? Thank you.
schema: {
data: function (data) {
return data || [];
},
model: {
id: "Id",
fields: {
Id: { editable: false,
nullable: false,
type: "number"
},
Frequency: { type: "string" },
FREQ_POOL: { type: "object" },//THIS IS A NAVIGATION IN MY MODEL
}
}
}
And here is my grid:
$("#AFTRCCFreqGrid").kendoGrid({
dataSource: AFTRCCDS,
columns: [
// { field: "Id", title: "Freq ID", format: "{0:c}", width: "120px" },
{ field: "Frequency", title: "Frequency", editor: categoryDropDownEditor, format: "{0:c}", width: "120px" },
{ field: "FREQ_POOL.Comments", title: "Comments", format: "{0:c}", width: "120px" },
{ command: ["edit", "destroy"], title: " ", width: "250px" }
],
toolbar: ["create"],
editable: "inline",
pageable: true
});
dataSource: AFTRCCDS,
columns: [
// { field: "Id", title: "Freq ID", format: "{0:c}", width: "120px" },
{ field: "Frequency", title: "Frequency", editor: categoryDropDownEditor, format: "{0:c}", width: "120px" },
{ field: "FREQ_POOL.Comments", title: "Comments", format: "{0:c}", width: "120px" },
{ command: ["edit", "destroy"], title: " ", width: "250px" }
],
toolbar: ["create"],
editable: "inline",
pageable: true
});
When I hit the "Add New Record Button" in the kendo grid, I get the following error:Uncaught TypeError: Cannot read property 'Comments' of undefined(anonymous function). Now here is the thing. I manually added a row to my SQL table, and I can use the kendo grid to UPDATE the row successfully. I can edit the navigation property "Comments".
But for some reason, when I create a new row, I cannot get it to work.My guess is that when I load the table it loads the navigation properties, but when I hit "Add New Record", it doesn't know how to create the navigation property "From scratch", whereas when I update a row it already has the navigation property info loaded.Any ideas how I would go about fixing this? Thank you.