How to change page size dropdown

In this documentation link it says :

"By default, dropdown list will show values as new int[]{ 5, 10, 12, 20 }. You can customize the dropdown values using the PageSizes property itself."

I've tried but it didn't work for me. I've looked at all documentation and couldn't find an example on how to do it. I know it is very simple but I must be missing something.

   void OnLoadMainGrid()

    {

        mainGrid.PageSettings.PageSizes = new int[] { 5, 12, 30, 50, 100 };






3 Replies 1 reply marked as answer

RS Renjith Singh Rajendran Syncfusion Team January 27, 2022 05:03 AM UTC

Hi Ben, 
 
Greetings from Syncfusion support. 
 
We suggest you to define your custom page size values in the PageSizes property of GridPageSettings to achieve this requirement. Please refer and use the code below, 
 
 
<GridPageSettings PageSize="10" PageSizes="@(new int[]{8, 9, 10, 22, 30})"></GridPageSettings>
 
 
Please get back to us if you need further assistance. 
 
Regards, 
Renjith R 



Marked as answer

LS Lee Stevens February 14, 2022 12:05 PM UTC

Hello,

To carry on from this, the "PageSizes" property doesn't seem to be working at all.

  • Setting PageSizes to false the dropdown is still displayed.
  • Setting PageSizes to an array as in your example above, it does not change the values within the dropdown and it defaults to displaying blank. If I have set the PageSize to 10 and 10 is in the PageSizes array, I would expect it to display 10. This should be the case even if they are both dynamic. Screenshot below is using the "GridPageSettings" that you have listed above on the latest nuget version.
  • SyncfusionAnotherBug.png
  • When an array is set to the "PageSizes" property and you change the page, the correct page does not get highlighted correctly on the page numbering at the bottom of the grid. The data within the grid changes correctly. Please use the above GridPageSettings to replicate.
We expect these bugs to be fixed

Lee.


RS Renjith Singh Rajendran Syncfusion Team February 15, 2022 11:44 AM UTC

Hi Lee, 
 
Query 1 : Setting PageSizes to false the dropdown is still displayed. 
We have confirmed this as an issue and logged the defect report “Pager dropdown is rendered when setting PageSizes to false for the same. Thank you for taking time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle) and including the fix in our upcoming bi-weekly release which is expected to be rolled out on or before the mid of March 2022. 
         
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.         
 
Query 2 : Setting PageSizes to an array as in your example above, it does not change the values within the dropdown and it defaults to displaying blank. If I have set the PageSize to 10 and 10 is in the PageSizes array, I would expect it to display 10.  
We checked this by setting PageSize as 10 in GridPageSettings and contained 10 in PageSizes array. The value(10) displays fine in the dropdown box. We are attaching a video showing the behavior from our side. Please download and refer the video from the link below, 
 
We would like to inform you that, on initial grid rendering if PageSize value is not provided in GridPageSettings, then by default 12 will be set as PageSize for grid. So at these cases, as 12 is not available in PageSizes array(new int[]{8, 9, 10, 22, 30}) the dropdownbox won’t show any value and it will display blank. This is a default behavior of Dropdown component. 
 
If you have provided PageSize value(say 10) which is available in the PageSizes array(new int[]{8, 9, 10, 22, 30}) then dropdownbox will show proper values and won’t show blank. So we suggest you to check this case from your side. 
 
If we have misunderstood your scenario or if you are facing difficulties then kindly share with us a issue reproducing sample along with a video demo to proceed further. 
 
Query 3 : When an array is set to the "PageSizes" property and you change the page, the correct page does not get highlighted correctly on the page numbering at the bottom of the grid. The data within the grid changes correctly. Please use the above GridPageSettings to replicate. 
We are not clear about this exact query. Kindly get back to us with the following details to proceed further. 
 
  1. Share with us a video demo explaining the problem you are facing.
  2. Could you please share with us a detailed description of this query(does not get highlighted correctly on the page numbering).
 
The provided information will help us analyze the problem, and provide you a solution as early as possible. 
 
Regards, 
Renjith R 
 


Loader.
Up arrow icon