I am creating a kendo grid that uses local datasouce with this code.
var jsondata = [{
abc: "Star Wars: A New Hope",
def: 1977,
ghi: 1977,
jkl: 1977,
mno: 1977,
pqr: 1977
}];
$("div#@code").Grid({
dataSource: {
data: jsondata,
schema: {
model: {
fields: {
abc: { type: "string" },
def: { type: "number" },
ghi: { type: "number" },
jkl: { type: "number" },
mno: { type: "number" },
pqr: { type: "number" }
}
}
},
pageSize: 20
},
height: 430,
scrollable: true,
sortable: true,
filterable: true,
pageable: {
input: true,
numeric: false
},
autoBind: true,
columns: [
{ title: 'abc', field: 'abc' },
{ title: 'def', field: 'def' },
{ title: 'ghi', field: 'ghi' },
{ title: 'jkl', field: 'jkl' },
{ title: 'mno', field: 'mno' },
{ title: 'pqr', field: 'pqr' },
],
});
The .Grid is an extension of the kendoGrid function, because I needed to custom the grid. Inside that function I call
// Initialize the grid.
kendo.ui.Grid.fn.init.call(that, element, options);
When I tested the code, the browser is giving me TypeError r is undefined. Which after I did my research, it is about the kendo grid trying to call dataSource update method that of course does not exist because I am using a local datasource.
Am I missing an option to set the kendo grid to not read the remote datasource and just use local datasource?
FYI the grid does not throw error and working just fine if the datasource is remote.