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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Is there an example oof paginated SfDatagrid with sorting and filter on database ?

Thread ID:

Created:

Updated:

Platform:

Replies:

147196 Sep 4,2019 07:35 AM UTC Sep 6,2019 05:31 PM UTC WPF 3
loading
Tags: SfDataGrid
Silvio
Asked On September 4, 2019 07:35 AM UTC

Hi,

is there an example how to use a paginated SfDatagrid that gets paginated datasource from a repository library where the filter and sorting commands are applied to the model returned by the repository and data is (paginated) recalculated and shown every time the user changes them ?

I mean I'd like to use a SfDatagrid using pagination but, when user clicks on a column to change sort order, I'd like all the data shown by the grid is recalculated asking to the repository the new sorted page.
In the same way I'd like, when the user clicks on the filter button of a particular column, he's able to filter not only on the current rows displayed by the grid but on all data present on the repository: so, as soon as he select a particular filter on a column, I'd like the whole current page is reloaded from the repository, according to the selected filter and sort set by the user.

Is there an example that shows me how to implement such a feature?
Thank you.

Gowtham Gopalsamy [Syncfusion]
Replied On September 5, 2019 01:11 PM UTC

Hi Silvio,   
   
Thanks for using Syncfusion controls.   
   
Your requirement can be achieved by Sorting or Filtering the column in pagination repository the whole page is reloaded in the repository. If the user clicks on the column to change the sort order of the repository whole current page is reloaded, same as like as filter. We have provided the below sample link.   
   
   
Please let us know, if you require further assistance on this.   
   
Regards,   
Gowtham   


Silvio
Replied On September 5, 2019 02:45 PM UTC

Thank you,

this example is very nice and it works exactly as I'd like, but it has a big problem: the OrderInfoRepository.PopulateOrders method is called only one time at startup.
So all the records are read from the database and put in memory. If I have a lot of records you can agree this is a big problem and waste of memory and makes pagination useless.

But I'd like a way to always load only 16 records per time from the database (the number of records displayed by the datagrid), related only to the current shown page.
I'd like to have the possibility to have a callback functions that indicates to the datagrid how many pages we have in the database according to the current filters, but witout loading all the records.
So I'd like the datagrid asks to a callback function to have the records for the current page.
I'd like, even if only one page of records have beeen loaded in memory, the user is able to filter and sort on ALL records in the database: as soon as he confirms a particular filter or a sort order, I'd like a callback function is called to the repository to reload the records of the current page (discarding the current ones) according to the new filters and sortings (so these information have to be passed to this callback function).

Is there such a possibility in the library?

Susmitha Sundar [Syncfusion]
Replied On September 6, 2019 05:31 PM UTC

Hi Silvio, 
 
Thank you for your update. 
 
Your requirement can be achieved by SfDataPager OnDemandPaging. In OnDemandPaging records are loaded when click the pages. But there is limitations for Sorting and Filtering, 
1.       Sorting and Filtering not applied for entire records, its applied for certain page records only. Please refer the below UG documentation, 
 
 
Please contact us for further assistance. 
 
Regards, 
Susmitha S   


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon