I'm having a problem trying to set the Grid's datasource after the grid has been created. Here is what I currently have, I've tried a bunch of diffenent vatiations of it, but none have worked. I can see from the Dev Tools in IE9 that its making the service call.
$(document).ready(
function
() {
grid = $(
"#grid"
).kendoGrid({
dataSource: {
pageSize: 10
},
height: 800,
scrollable:
true
,
sortable:
true
,
filterable:
true
,
pageable: {
input:
true
,
numeric:
false
},
columns: [
{
field:
"UnitId"
,
title:
"ID"
},
{
field:
"UnitName"
,
title:
"Name"
,
width: 200
},
{
field:
"Location"
,
width: 200
},
{
field:
"Number"
,
title:
"Number"
},
{
field:
"Rating"
},
{
field:
"Date"
,
title:
"Date"
}
]
});
setDataSource()
});
function
setDataSource() {
//check if the data is in the db
var
dataSource =
new
kendo.data.DataSource({
type:
"json"
,
transport: {
read: {
complete:
function
(e){ debugger; $(
"#grid"
).data(
"kendoGrid"
).dataSource.data(e); $(
"#grid"
).data(
"kendoGrid"
).dataSource.read();}
}
},
schema: {
model: {
fields: {
UnitId: { type:
"string"
},
UnitName: { type:
"string"
},
Location: { type:
"string"
},
Number: { type:
"string"
},
Rating: { type:
"string"
},
Assessed: { type:
"date"
}
}
}
},
});
}