I created custom datasource for my kendo MVC grid. Everythink is working, data are comming back from server. But in grid are displayed only empty cells. Like on this image: Code for MVC grid:
@(Html.Kendo().Grid<PageViewModel>()
.Name("pageGrid")
.Columns(columns =>
{
columns.Bound(item => item.Name).Width(100);
})
.DataSource(dataSource => dataSource.Custom()
.Type("aspnetmvc-ajax")
.PageSize(10)
.ServerPaging(true)
.ServerSorting(true)
.ServerFiltering(true)
.Transport(transport => transport
.Read("ReadPages", "Page")
)
.Schema(schema => schema
.Data("result.data")
.Total("result.total")
.Errors("result.errors")
.Model(m => m.Id(p => p.Name))
)
)
)
When I do the same with javascript, it works and data are showed.
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "@Url.Action("ReadPages", "Page")",
type: "post",
dataType: "json"
}
},
schema: {
data: "result.data",
total: "result.total"
}
});
var grid = $("#pageGrid2").kendoGrid({
dataSource: dataSource
});
Where is the problem ? Thanks!
EDIT: I got this response:
{
"success": true,
"result": {
"data": [
{
"id": "1",
"name": "Test",
"content": "Test obsahu",
"url": "test",
"title": "test",
"description": "test"
},
{
"id": "7",
"name": "Jmeno",
"content": "htmlfdgsrg erg erger",
"url": "test2",
"title": "test",
"description": "Desc grid"
}
],
"total": 2,
"aggregateResults": null,
"errors": null
},
"error": null,
"unAuthorizedRequest": false
}