Working sample of how to use UseOnDemandPaging

Hi,

I'm really struggeling to get my combination of SfDataPager / SfDataGrid to work with UseOnDemandPaging=true.
Just to avoid misunderstandings:
  • I have a pretty large DataSource (approx. 50000 items) which I'm trying to view in a SfDataGrid
  • I don't want to add a Load More because there are way to many items
  • I thought using a virtual pager would be more effective
Is UseOnDemandPaging suitable for not loading the complete collection? The DataPager is not generating any pages. How do I tell him, that the grid will have 50000 items?

I've tried to set the PageCount, but that doesn't work. Setting the MaxItemsCount in PagedCollectionView doesn't work either.
The version is 16.1.0.26 from your NuGet.

Could you please provide a working example? Or am I wrong and what I'm trying to achieve is not supported by SfDataPager?

Kind regards,
Daniel


3 Replies

JA Jayaraman Ayyanar Syncfusion Team March 30, 2018 11:19 AM UTC

Hi Daniel, 
 
Thank you contacting Syncfusion support. 
 
We have checked your query for “Working sample of how to use UseOnDemandPaging”. Actually in normal Paging, data collection is entirely loaded initially to the SfDataPager. However, SfDataGrid also allows to load the data for the current page dynamically by setting the SfDataPager.UseOnDemandPaging to true. To load current page item dynamically, by hook the OnDemandLoading event. In the OnDemandLoading event, use theLoadDynamicItems method to load the data for the corresponding page in SfDataPager. You can get the total number of grid items in the GridTapped event. 
We have prepared a sample based on your requirement and you can download the same from the below link. http://www.syncfusion.com/downloads/support/directtrac/general/ze/SfDataPager_OnDemandpage833850889  
Regards, 
Jayaraman.  



DF Daniel Fischer April 6, 2018 09:49 AM UTC

Hi Jayaraman,

sorry for the late response and thank you very much for the example.
I found out, that my Binding was incorrect and therefore UseOnDemandPaging was false instead of true.
After fixing I was able to set the PageCount and finally the OnDemandLoading was called.

Got it working now. But I suggest you add the example right to your documentation. If I'm not mistaken the part where you need to set the PageCount is missing.

Kind regards,
Daniel


JA Jayaraman Ayyanar Syncfusion Team April 9, 2018 04:57 AM UTC

 
We are glad that your issue has been resolved . Thank you for your valuable feedback. 
 
We will consider your feedback to enhance the documentation of the OnDemandPaging part in the paging of the SfDataGrid and it will be publish in live on or before the 2018 Volume 2 release. 
 
Regards, 
Jayaraman. 
 


Loader.
Up arrow icon