We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is it possible to customize OnDemandPaging also with filters and sorts ?


I would like to to use the paginated SfDatagrid in order not to load in memory all the data for large amount of data.
I'm using Entity Framework 6.0 CodeFirst as database model provider.
I'm also considering the possibility to have a web service that could implement oData protocol to make the same queries as in EF (via a proxy class).

Anyway, beside the paging, I obviously would like to use also column order and filtering (all the complete UI features available in SfDatagrid).
So I would like, using custom OnDemandPaging, to be able to supply to the SfDatagrid ONLY the data requested each time by the user.

For example, if the user (using SfDataGrid UI interface) requests page 2 of Customer's Entities, where customer Surname contains letter "S" and the City is Rome, all ordered by Company Name descending, I would like this EXACT query is passed to my EF model and only this query is made to the database to select the affected records.

I've searched a lot on your online code examples, but I have not found anything really similar to what I'm asking for.
So I ask you if there is such a possibility and if you can show me a code example about it.
Thanks in advance,


4 Replies

SP Sowndaiyan Paulpandi Syncfusion Team January 22, 2016 02:46 PM UTC

Hi Silvio,

Thanks for contacting Syncfusion Support.

OnDemandPaging does not support DataTable and Filtering. So we recommend you to use
Observable collection in your application. You can enable the sorting by setting SfDataGrid.AllowSorting as True in SfDataGrid definition.

Please let us know if you need further assistance.



SI Silvio January 25, 2016 08:47 PM UTC

Suppose I'm able to implement my model using the interface


What could happen if I bound SfDatagrid DataContext to such a model that implements this interface?

Would you recall the methods implemented by this interface?

Should it be possible, in this case, to implement my own methods to retrieve the sorted and ordered records, in accordion to the Filter and Sort properties, supposing the SfDataGrid sets these properties when performing sorts and filterings ?

Should it be a good idea?

SI Silvio January 26, 2016 02:03 PM UTC

I've found in the forum this link:


This is exactly what I'd like to have.
But if I click to the linked zip file, I obtain an error.
Is it possible to have this code example ?

SP Sowndaiyan Paulpandi Syncfusion Team January 27, 2016 04:02 AM UTC

Hi Silvio,

For additional information, In OnDemandPaging, PagedSource loads only the current page data. When you navigate to another page, OnDemandLoading event is fired and loads another set of data. Within this event you can load the particular set of data for the specific page. For example in OnDemandLoading event you can load the data like “Name” property contains with letter “S” on the corresponding page. We have prepared a sample for achieve your requirement and you can download the sample from the location,

In this sample we have methods “ApplySort” and “ApplyFilter” for perform the filtering and sorting on that particular collection before load the item on corresponding page.

Sample : https://www.syncfusion.com/downloads/support/forum/121748/ze/OnDemandPaging1209217419

If you navigate to previous page, OnDemandLoading event is not fired and load the existing maintained data to the corresponding page. If you do not want to maintain the previous page old data, you can call PagedCollectionView.ResetCache() in OnDemandLoading event. This method can be resets the page data except current page.

You can refer the below link for know more about the OnDemandPage Loading

Link :

Link : https://help.syncfusion.com/wpf/sfdatapager/pagenavigation



Live Chat Icon For mobile
Up arrow icon