I am very new to kendo UI and getting similar challenges as below(except I dont mind having a fixed data structure for grid):
How to pass MongoDb Json value to KendoUI grid using webservice method
$("#grid").kendoGrid({
dataSource: {
transport: {
read: {
url: "http://localhost:8080/urlPath",
dataType: "json",
}
},
schema: {
data: "score"
}
columns:[{
field: "physics"
},
{
field: "chemistry",
}],
});
Json looks like:
[{"score"[{"physics:99", "chemistry" :95}]},{"score"[{"physics:99", "chemistry" :95}]}]
I am struggling from last few days and have tried approaches like:
Convert dbcursor object into json
http://www.codeconfuse.com/2014/03/mongodb-convert-data-getting-from.html
Here's the related code from above URL:
while(cursor.hasNext()) {
BasicDBObject obj = (BasicDBObject) cursor.next();
jsonobj = new JSONObject();
BasicDBList name = (BasicDBList) obj.get("Name");
jsonobj.put("Incident Date", obj.getString("Incident Date"));
jsonarray.put(jsonobj);
}
return jsonarray;
JSON json =new JSON();
String serialize = json.serialize(cursor);
But the kendo Grid seems to be rejecting it. Please assist.