Hello,
I'm attempting to use the React wrappers (or maybe the new React components) with an MVC backend.
In the native jQuery implementation we can just set the Datasource's transport.read property to an API endpoint, load the kendo.aspnetmvc.js library, and get database level filtering of our requests from the filtering/sorting/paging interactions on the grid. Like this
public
JsonResult Billbacks([DataSourceRequest]DataSourceRequest request)
{
var data= _context.Mytable;
var results = data.ToDataSourceResult(request);
return
Json(results, JsonRequestBehavior.AllowGet);
}
dataSource =
new
kendo.data.DataSource({
transport: {
read: {
url:
'/my/api/endpoint'
,
dataType:
'json'
}
},
serverSorting:
true
,
serverGrouping:
true
,
serverPaging:
true
,
serverFiltering:
true
,
pageSize: 2,
schema: {
model: {
fields: {
Id: { type:
'number'
}
}
},
}
});
But, when I try this in the kendo grid react wrapper it isn't playing nicely with the ASP.NET MVC Kendo DataSourceResponse.
By default it returns an object like this:
{
"Data"
: [
{
"Id"
: 1,
"Amount"
: -50
},
{
"Id"
: 2,
"Amount"
: -99
}
],
"Total"
: 10,
"AggregateResults"
:
null
,
"Errors"
:
null
}
The kendo.aspnetmvc enhanced grids know how to deal with this, but the react wrapper kendo grid just calls that response the data for row 0. If I return `Json(result.Data)` then I get the resulting data back, but the total number of results doesn't return so the grid can't show it's page numbers properly.
How is serverside paging supposed to work with the kendo react wrapped grid? Is the MVC DataSourceRequest/DataSourceResult controller stucture appropriate to use with it? Hopefully there's a way to do this without rewriting all that functionality (although to use redux to handle the API calls it seems based on your examples that re-writing that funcionality is indeed the way to do it).