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.
Unfortunately, activation email could not send to your email. Please try again.

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

Thread ID:

Created:

Updated:

Platform:

Replies:

121748 Jan 21,2016 09:01 AM Jan 26,2016 11:02 PM WPF 4
loading
Tags: SfDataGrid
Silvio
Asked On January 21, 2016 09:01 AM

Hi,

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,

Silvio

Sowndaiyan Paulpandi [Syncfusion]
Replied On January 22, 2016 09:46 AM

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.

Regards,

Sowndaiyan


Silvio
Replied On January 25, 2016 03:47 PM

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

IBindingListView.

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?


Silvio
Replied On January 26, 2016 09:03 AM

I've found in the forum this link:

http://www.syncfusion.com/forums/110399/server-side-paging-and-sorting-with-editable-grid

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 ?

Sowndaiyan Paulpandi [Syncfusion]
Replied On January 26, 2016 11:02 PM

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 : http://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 :
http://help.syncfusion.com/wpf/sfdatagrid/paging

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



Regards,

Sowndaiyan



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;