How to bind JSON data with Kendo Grid
The resultant JSON is the culprit here. The kendo dataSource by default looks for the return object to have the items in an array called results. Simple to fix. Just need to define where the data is in the response JSON object.
dataSource: { transport: { read: { url: "http://localhost/KendoServices/Web/GetProductDetails", dataType: 'json' } }, pageSize: 10, schema: { data: function(response) { return response.d; } }},
--Edit...Whoops, missed something else. Your type: 'json'
should be inside your read object, and should be dataType: 'json'
try this
dataSource: { transport: { read: { url: "http://localhost/KendoServices/Web/GetProductDetails", contentType: 'application/json; charset=utf-8', dataType: "json" } }, schema: { data: "d" } }}
This is how I've done it:
$("#grid").kendoGrid({ dataSource: { transport: { read: { url : pUrl, dataType: "json" } }, pageSize:40, schema: { data: function(response) { return response.json; } } }, height: 550, groupable: false, sortable: true, pageable: { refresh: false, pageSizes: false, buttonCount: 5 }, columns: [ { field: "SEQ_NO", title: "No", filterable: false, width: 120 }, { field: "LOT_NO", title: "Lot No (INS' No)" }, { field: "TYPE", title: "INPUT (At 100% Burden)" }, { field: "ATTRIBUTE01", title: "1.0 In" }, { field: "ATTRIBUTE02", title: "2.0 In" }, { field: "ATTRIBUTE03", title: "0.05 In" }, { field: "RESILT", title: "RESILT" } ] });