Menu

Kendo Grid sorting and filtering

Kendo Grid Default Sort Order

The kendo grid can ignore the ordering on a datasource if the read action gets an Iquerable or Ienumerable. This is because the call to SQL is not made until the kendo code performs its actions that trigger the call. As a result the order by included on the original can be lost.
To specify a default sort then add the following to the Datasource

Kendo Grid Server side Sorting and Filtering

The controller gets the data from the database or wherever. If the data returned is IQuerable then the ToDataSourceResult will apply its stuff in order to push the filtering as far downstream as possible ie at database SQL level
In some cases the data is not simple enough that it is a query to the database. Some calculations may need to be performed so in that cases then all the data is pulled from the database and performs necessary calculations, therefore is Ienumarable rather than a Iqueryable list. In this case ToDataSourceResult is just working on the list in memory.

Since that means everything has to be pulled from database then in attempt to speed that operation up I checked if it is possible to get the list of data required first before doing the data generated.

Commonly the data is retrieved and the sort and filtering is applied in the controller with an ToDataSourceResult
example:

So the plan was to get the necessary list of items from the database using the filtering from the grid then pass that list of Ids to another function that will get the desired calculated data. Thus reducing the amount of data pulled from the database.
Testing code used as follows

This meant the controller applied filtering to get a list of tag id and then past that smaller set to the read() that could filter a smaller SQL set and just do the property calculations for that set.

However fundamentally flawed as filtering from the kendo grid could be on a calculated field so can never be done at SQL level. Always need to pull the full set. (Unless you want to disable the filtering on the calc fields in the grid)
Caching is required instead.