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