first pagesize option not selected for custom page sizes

Ive created a custom selection of page sizes for a datagrid but when the grid loads it sets the default size of 12 not the first size in my custom list.  This is my grid definition


<SfGrid TValue="ClientDto" AllowPaging="true" Toolbar="@(new string[] {"Add","Edit","Delete","Update","Cancel"})">

    <GridPageSettings PageCount="5" PageSizes="@pagesizes"></GridPageSettings>

    <SfDataManager AdaptorInstance="@typeof(ClientAdaptor)" Adaptor="Adaptors.CustomAdaptor"></SfDataManager>

    <GridEditSettings AllowAdding="false" AllowEditing="false" AllowDeleting="false" ></GridEditSettings>



and in my codebehind I have this

public object[] pagesizes = new object[] { 5, 10, 15, 20,50 };


so when the grid first loads I would expect a page size of 5 to be set, its not though, it defaults to 12.  How can I make the grid use the first item in my list ?


FirstNotSelected.jpg

PageSizeSelection.jpg


3 Replies

PS Prathap Senthil Syncfusion Team July 1, 2024 07:03 AM UTC


Hi Mark,


Based on your requirement, we suggest using the default grid page size, which is set to 12. If you want to customize the page size, we recommend setting the PageSize property to 5 to achieve your desired result. Kindly refer to the code snippet and sample below for your reference.

<SfGrid DataSource="@GridData" @ref="Grid" AllowPaging="true" Height="268px">

    <GridPageSettings PageCount="5" PageSize="5" PageSizes="@pagesizes"></GridPageSettings>

    <GridColumns>

………..    </GridColumns>

</SfGrid>


Reference:
https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.GridPageSettings.html#Syncfusion_Blazor_Grids_GridPageSettings_PageSize

Regards,
Prathap Senthil



MW mark wheeler replied to Prathap Senthil July 1, 2024 07:21 AM UTC

That still doesnt solve my problem, when the page loads initially the drop down page size selector is empty


paginh.jpg



PS Prathap Senthil Syncfusion Team July 2, 2024 06:39 AM UTC

We are unable to reproduce the reported issue when attempting to reproduce the issue in the version 26.1.40 . For your reference we have attached screen shot and simple sample .So, to
further proceed with the reporting problem, we require some additional clarification from your end. Please share the below details to proceed further at our end.

  • To analyze the reported issue, could you please share a simple and reproducible sample that demonstrates the problem? This will assist us in identifying the issue more efficiently and providing a resolution.
  • Or kindly share your attempt to replicate the issue using the attached simple sample.


Above-requested details will be very helpful in validating the reported query at our end and providing a solution as early as possible. Thanks for your understanding.


Sample: https://blazorplayground.syncfusion.com/embed/rNBfZmZhMORQMTXp?appbar=true&editor=true&result=true&errorlist=true&theme=material3


Loader.
Up arrow icon