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

Server Side pagination with custom filter

Thread ID:

Created:

Updated:

Platform:

Replies:

149763 Dec 8,2019 07:48 PM UTC Jun 18,2020 04:57 PM UTC WPF 13
loading
Tags: SfDataPager
Dima
Asked On December 8, 2019 07:48 PM UTC

I have a table with 5 fields. It is formed from a filter in which there are dozens of parameters. How to organize server pagination?

Mohanram Anbukkarasu [Syncfusion]
Replied On December 9, 2019 12:34 PM UTC

Hi Dima,   
  
Thanks for contacting Syncfusion support.   
  
We are not clear about query SfDataPager and the term “organize server pagination”. Can you please provide us more details about your requirement and the need for the SfDataPager in your application? So that we could analyze and provide you solution at the earliest.    
  
Regards,   
Mohanram A  


Dima
Replied On December 10, 2019 12:38 PM UTC

I have a form with filters. The filter is sent to the server and receives a table in response. There can be a lot of data in the table, and for this reason paging is needed. Your 2 controls SfDataPager and SfDataGrid already work for me. How can I change the non-server version, under the server

Mohanram Anbukkarasu [Syncfusion]
Replied On December 11, 2019 01:05 PM UTC

Hi Dima,   
  
Thanks for the update.    
  
You are using SfDataPager and SfDataGrid for handling the large data received from the server. But we are unclear about your requirement in the server. Please elaborate your requirement for SfDataPager and SfDataGrid in server. The provided details are insufficient to understand your requirement and to replicate your scenario. Please provide more information about your requirement in detail like what you have already done and what you are trying to do with some illustrations if possible. This will help us to understand your scenario and to provide you a solution.   
  
Regards,   
Mohanram A  


Dima
Replied On December 12, 2019 12:01 PM UTC

I attached the code - this is part of the whole project, cut out everything that is not related to this issue. There is a method that receives a list of objects by the filter and places them in SfDataPager, and SfDataGrid ItemsSource = "{Binding ElementName = sfDataPagerSbobet, Path = PagedSource}". I need an option when in the calculation I get the 1st page and the total number of lines. Based on this control, it builds line numbering, and when the buttons are switched, another request to the server is made, in order to obtain the necessary data, the corresponding page is pressed and displayed in SfDataGrid.

Attachment: ServerSideGrid_51428d72.zip

Mohanram Anbukkarasu [Syncfusion]
Replied On December 13, 2019 11:32 AM UTC

Hi Dima,   
  
Thanks for the update.    
  
We suspect that your requirement is to remain on the current page when new pages are added due to addition of data from the server. It can be achieved by using setting the same page index to the SfDataPager after the list of objects are received from the server as shown in the below code example.    
  
Code example:    
  
<Button Content="Рассчитать" VerticalAlignment="Bottom" Margin="15,15,20,50" HorizontalAlignment="Right" Height="50" Width="{Binding ElementName=xgtoggleBtn, Path=ActualWidth,UpdateSourceTrigger=PropertyChanged}"  Panel.ZIndex="100" CommandParameter="{Binding ElementName=sfDataPagerSbobet}" Command="{Binding Path=SaveCommand}"></Button> 
 
 
public void Execute(object parameter) 
{ 
     var dataPager = (parameter as SfDataPager); 
     var currentPageIndex = dataPager.PageIndex; 
     this.execute(parameter); 
     if (currentPageIndex < dataPager.PageCount) 
         (parameter as SfDataPager).PageIndex = currentPageIndex; 
} 
  
   
We have modified the provided sample to generate random data and this requirement and it is available in the below link for your reference.    
  
  
Please refer the above sample and let us know if we have misunderstood your requirement.   
  
Regards,   
Mohanram A  



Dima
Replied On December 13, 2019 03:45 PM UTC

This is not what I asked for. I need to get only the 1st page out of 100 from the server at the click of a button. In order for the SfDataPager control to display 100 pages, it needs to put a list of 100 * PageSize in Source. Then he will draw these 100 pages at his place. And there will be an opportunity to pass to other pages.

How can I show 100 pages in SfDataPager without putting 100 * PageSize elements in its source? I would update the data in the table by the SfDataPager.PageIndexChanging event - I would get a new SfDataPager index, make a request with this index to the server and display this list of data in the table.

Mohanram Anbukkarasu [Syncfusion]
Replied On December 16, 2019 01:27 PM UTC

Hi Dima, 

Thanks for the update.  

We are still unclear with your requirement “How can I show 100 pages in SfDataPager without putting 100 * PageSize elements in its source? “. Let us consider the PageSize of SfDataPager is 15 and on a button click you are receiving 45 records from the server. We suspect that your requirement is to get only first 15 records from the server on the button click and to get next 15 records when the button is clicked again and so on.  
Kindly provide details about your requirement with some illustrations as specified above. It will be helpful for us to understand your exact requirement and to provide the possibilities to achieve the same without any further delay. 

We regret for the inconvenience. 

Regards, 
Mohanram A. 


Dima
Replied On December 17, 2019 11:54 AM UTC

You got it right. I have a method that returns an object of type: 
{objs: [{...}, .., {..}], countAll: 45, page: 1, countOnPage: 15}. 
objs has 15 elements. I need to show 3 pages in the SfDataPager control, select the first page and show in SfDataGrid those 15 elements that came. But at the page change event in SfDataPager, you need to make an additional request to the north to receive the 2nd page with the following 15 elements 
{objs: [{...}, .., {..}], countAll: 45, page: 2, countOnPage: 15}.

Susmitha Sundar [Syncfusion]
Replied On December 18, 2019 12:10 PM UTC

  
Hi Dima,  
  
  
Thank you for your update.  
  
Based on your provided details, we suspect that you need to load the data while clicking on the pager buttons. If so, you can use the OnDemandPaging for SfDataPager. Please find more details from below UG documentation,  
  
  
  
Please revert us, if you need further assistance.  
  
Regards,  
Susmitha S  


Dima
Replied On January 28, 2020 03:04 PM UTC

Yes, that was what I needed. But there is a problem with data model binding. I attach pieces of code - I can not send all the code.

When switching to the next page, OnDemandLoading is triggered - I get a new portion from the server in it and execute sfDataPager.LoadDynamicItems (args.StartIndex, items); The index in sfDataPager switches to the next, but the data page is not displayed. you must manually click on the page number itself in sfDataPager to update the data - the same behavior if you click on the page numbers themselves in sfDataPager. I will attach the video and code

In the video archive, the control with SfDataGrid and sfDataPager and the data model for this control.

Attachment: Views_6526356b.zip

Susmitha Sundar [Syncfusion]
Replied On January 29, 2020 11:28 AM UTC

Hi Dima,   
   
Thank you for using Syncfusion controls.   
   
We have checked the reported issue and we are unable to replicate the issue from our end. OnDemandLoading works fine when click the both navigation button and page number button. We have prepared a sample for your reference.   
   
  
We have tested with Syncfusion version 17.4.0.39.   
   
Please check the above sample and revert us if you still facing the same issue? If yes, please modify the sample based on your scenario. It will be helpful for us to check on it and provide you the solution at the earliest.     
   
Regards,   
Susmitha S   


Ulfried Koch
Replied On June 17, 2020 01:22 PM UTC

Dima Replied On January 28, 2020

" I get a new portion from the server in it and execute sfDataPager.LoadDynamicItems (args.StartIndex, items); The index in sfDataPager switches to the next, but the data page is not displayed. you must manually click on the page number itself in sfDataPager to update the data "


I can confirm that this happens with our on-demand paging too. Grid shows an empty page - only after manually clickickig on the Page-Button, the data comes in.
We are using still 15.4.20 I wrote an workaround like this:

  public async static void DataPagerMoveToPage(int page)
        {

            resultDocumentsDataPager.PagedSource.ResetCacheForPage(page);
            resultDocumentsDataPager.MoveToPage(page);

            // check if MoveToPage was sucessfull (we have some data)
            if (resultDocumentsDataPager.PagedSource.Count > 0)
            {
                return;
            }

            // Workaround: Syncfusion shows sometimes only an empty page.
            // In this case we repeat until we have some data. Usully data are
            // coming in after 2-5 repeats.
            // In any case, we do not wait longer than 1000 ms.
            for (int i = 0; i < 50; i++)
            {
                if (resultDocumentsDataPager.PagedSource.Count == 0)
                {
                    await Task.Delay(20);
                    resultDocumentsDataPager.MoveToPage(page);
                }
                else
                {
                    break;
                }
            }
        }

would be great to have better solution..


Vijayarasan Sivanandham [Syncfusion]
Replied On June 18, 2020 04:57 PM UTC

Hi Ulfried Koch,

Thank you for contacting Syncfusion support.

We have checked the reported issue “The index in sfDataPager switches to the next, but the data page is not displayed” and unable to replicate the issue from our end. We have tested with Syncfusion version 15.4.0.20. it is working fine as expected. Please find the tested sample and video demo from our end in the below link,
 
   
if you still facing the same issue? If yes, please modify the sample based on your scenario.  
   
It will be helpful for us to check on it and provide you the solution at the earliest.     
   
Regards,   
Vijayarasan 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