I have the following view (following the guidance here: http://www.kendoui.com/blogs/teamblog/posts/12-10-25/using_kendo_ui_with_mvc4_webapi_odata_and_ef.aspx), and although I can see in Fiddler that the OData request is correct and sends back what looks to be perfectly good JSON, the grid remains empty with "No items to display". What am I missing?
<
div
id
=
"grid"
></
div
>
<
script
>
$(function() {
$("#grid").kendoGrid({
dataSource: {
serverFiltering: true,
serverPaging: true,
serverSorting: true,
type: "odata",
transport: {
read: {
url: "/api/LegalEntity",
dataType: "json"
},
parameterMap: function(options, type) {
var paramMap = kendo.data.transports.odata.parameterMap(options);
delete paramMap.$inlinecount; // <-- remove inlinecount parameter.
delete paramMap.$format; // <-- remove format parameter.
return paramMap;
}
},
schema: {
model: {
fields: {
Name: { type: "string" }
}
},
data: function(data) {
return data; // <-- The result is just the data, it doesn't need to be unpacked.
},
total: function(data) {
return data.length; // <-- The total items count is the data length, there is no .Count to unpack.
}
},
pageSize: 10
},
height: 430,
filterable: true,
sortable: true,
pageable: true,
columns: [{
field: "Name",
filterable: true
}]
});
});
</
script
>