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

(Paging question) Is it possible to set PageCount while using OnDemandLoading depending on elements count?

Thread ID:

Created:

Updated:

Platform:

Replies:

144096 Apr 18,2019 08:06 AM UTC Apr 19,2019 09:03 AM UTC Xamarin.Forms 1
loading
Tags: SfDataGrid
Alexandr
Asked On April 18, 2019 08:06 AM UTC

Hello

I use your SfDataGrid in my project in Xamarin.Forms. But I have a problem. I should use paging in my case, but I can't use normal paging because I have much data to load. So I use OnDemandLoading, but I can't understand how to bind PageCount (which must be setted) with number of my data. As example: I have 5000 rows and 20 rows per page, so PageCount should be equals 5000/20 = 250. I can never use PageCount = 250 because I always have different number of rows.

Could you tell me please what I can do in this case?

Best regards,
Alexandr

Subburaj Pandian Veluchamy [Syncfusion]
Replied On April 19, 2019 09:03 AM UTC

Hi Alexandr 
  
Thank you contacting Syncfusion support. 
  
How to define page count for OnDemandPaging 
We have checked your requirement of “Changing the page count for DataPager and it will change based on the records count”, refer the following code snippet to change the page count in OnDemandLoading. 
  
[C#] 
private void DataPager_OnDemandLoading(object sender, Syncfusion.SfDataGrid.XForms.DataPager.OnDemandLoadingEventArgs args) 
{ 
    dataPager.LoadDynamicItems(args.StartIndex, viewModel.OrdersInfo.Skip(args.StartIndex).Take(args.PageSize)); 
    //Here we have modified the page count when we generate items for third page. Modify the pagecount based on your requirement. 
    if (args.StartIndex == 30) 
    { 
        //Initially 10 buttons are generated now changed to 5. 
        dataPager.PageCount = 5; 
    } 
} 
  
We also attached the sample (SfDatGrid version 17.1.0.40) for your reference, 
 
 
Please get in touch with us if you would require any further assistance. 
 
Regards,
Subburaj Pandian V 


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