Hi I have a kendo Grid that is bound to this kendo.Data.DataSource object:
var viewDataSource = new kendo.data.DataSource({
transport:{
read: { url: "xxx", datatype: "json", type: "GET"},
update: {url: "YYY",datatype: "json",type: "POST"},
parameterMap: function (options, operation) { if (operation !== "read" && options) {return { models: kendo.stringify(options) };}}},
schema: {model: {
id: "divisionID",
fields: { divisionID: {type: 'number'},name: { type: 'string' },available: { type: 'boolean'},countryISOCode: { type: 'string'}}
}}});
The data source is bound to kendo grid
$("#Grid").kendoGrid({
dataSource: viewDataSource,
editable: "inline",
editable: true,
scrollable: true,
toolbar: ["save", "cancel"],
sortable: {mode: "single",allowUnsort: true},
columns: [
{ field: 'name', title: 'Division Name' },
{ field: 'available', title: 'Available'},
{ field: 'countryISOCode', title: 'Negotiation Country'}
]
}
I follow the standard practice to define the data source and when I head save it give me an error " Cannot read property 'data' of undefined".
I am able to get around this problem by changing the definition of my model for the ID field from 'number' to 'string', if I do that then the Grid save will actually hit my POST url address.
I want to know if Kendo Grid suppose to support "Number" data type for ID or not ? Why do I care? Because on database we usually auto increment column and that tends to be number. My workaround would be converting this value from number to string on the repository layer. Its just bizarre.
Thanks!