The extension method that KendoUI adds (ToDataSourceResult), seems to fail on Pages > Page #1. It works fine the first time the page loads, but then when I try to use it with virtual scrolling, to fetch pages, 2,3,4 ... N asynchronously, the method ignores all the data in the IEnumerable object I am trying to transform.
My code is as follows:
I have a MVC controller that fetches data like so:
Database database = Database.GenerateDatabase();
ResultSet queryResults = database.GetEvents(
FilterHelper.GenerateQueryCriteria((List<IFilterDescriptor>) request.Filters, request.Page, request.PageSize)
);
Database.GetEvents returns an object like so:
public class ResultSet {
public List<ResultSetRow> Set;
public int PageRowCount;
public int TotalRecordCount;
}
Each ResultSetRow, is an instance of a class that has 1 string, and 2 ints as properties.
At this point, I set a break point and inspect the contents of ResultSet.Set. The database is properly populating the List with as many records as I specified with request.PageSize. I have confirmed that results are being returned for any and all page numbers.
The next stage, everything goes badly:
DataSourceResult result = ((IEnumerable<ResultSetRow>) queryResults.Set).ToDataSourceResult(request);
I inspect the contents of the DataSourceResult object, and its array property 'Data' is empty.
Why is my model (ResultSetRow), failing to convert to Kendo's DataSourceResult object?
Some additional info:
- Aggregates, groups, sorts, and filters are not being used.
- The number of results returned by Database.GetEvents matches the size of the page requested.
Thanks for your help SO community