I have an existing REST service which returns JSON. I have been instructed to use this REST service and display the returned JSON in a Kendo UI Grid.
My call to the REST service (through JavaScript) returns a JSON object, so I already have the JSON -- my understanding is that I do not have to add a "url" property to the dataSource.
My question is, if you have the JSON object how to you build/write the dataSource to populate the Kendo UI Grid? Or did I ask a question that has been already answered?
Something like this:
I hope this makes sense.
I appreciate any help with this -- I am still learning Kendo UI.
Thanks!
My call to the REST service (through JavaScript) returns a JSON object, so I already have the JSON -- my understanding is that I do not have to add a "url" property to the dataSource.
My question is, if you have the JSON object how to you build/write the dataSource to populate the Kendo UI Grid? Or did I ask a question that has been already answered?
Something like this:
JSONObj
// returned object from REST call
// formatted like:
/*
{
"items": [
{
"employee": "John Doe",
"team": "INFRASTRUCTURE"
}
]
}
*/
// Build Kendo UI grid datasource...
var
sharedDataSource =
new
kendo.data.DataSource({
data: [JSONObj;]
});
$(
"#grid"
).kendoGrid({
dataSource: sharedDataSource,
columns: [
{
field:
"employee"
,
title:
"Employee"
},
{ field:
"team"
,
title:
"Team"
,
}
]
});
I hope this makes sense.
I appreciate any help with this -- I am still learning Kendo UI.
Thanks!