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. Image for the cookie policy date
close icon

PageSize and CurrentPage not updating

Hello,
Using a simple grid with paging enabled I have two problems.
First it's not possible to bind the property CurrentPage to a custom property (of "int" type).
Second using @ref =DefaultGrid to retrieve the values of PageSize and CurrentPage it seems they are not correctly updated. To retrieve values I used DefaultGrid.PageSettings.CurrentPage and DefaultGrid.PageSettings.PageSize; you can see in the browser's console that they are not updated: just click on "Log me" button and you will see in the console the default values.

I attach an example with both problems.

Thank you,
Riccardo

Attachment: SyncfusionBlazor_9443648c.zip

9 Replies

RS Renjith Singh Rajendran Syncfusion Team August 28, 2019 12:48 PM UTC

Hi Riccardo, 

Thanks for contacting Syncfusion support. 

Based on your requirement, we have modified the sample which you have shared with us. Please download the working sample from the link below, 
 
Query 1 : First it's not possible to bind the property CurrentPage to a custom property (of "int" type). 
We suggest you to set the value for the CurrentPage property in the “OnLoad” event, please use the below highlighted code below to set the “PageSize”, “PageSizes”, “CurrentPage” for Grid using custom property, 

 
            <EjsButton OnClick="@Press"> LOG ME </EjsButton> 
            Current page__  @CurrentPage 
            Page size__ @PageSize 
 
            <EjsGrid @ref="DefaultGrid" @ref:suppressField DataSource="@Orders" AllowPaging="true" Height="200"> 
                <GridEvents OnLoad="Load" TValue="Order"></GridEvents> 
                <GridPageSettings PageCount="2" PageSize="@PageSize" CurrentPage="@CurrentPage" PageSizes="@PageSizes"></GridPageSettings> 
                ... 
            </EjsGrid> 
 
@code{ 
    private EjsGrid<Order> DefaultGrid; 
    public int GridHeight; 
    public List<Order> Orders { get; set; } 
    public int CurrentPage = 3; 
    public int PageSize { get; set; } 
    public object PageSizes; 
 
    ... 
 
    public void Load(object args) 
    { 
        var RowHeight = 37; //height of the each row 
        Int32.TryParse(this.DefaultGrid.Height, out GridHeight); //grid height 
        var PageSizee = (this.DefaultGrid.PageSettings as GridPageSettings).PageSize; //initial page size 
        decimal PageResize = ((GridHeight) - (PageSizee * RowHeight)) / RowHeight; //new page size is obtained here 
        PageSize = PageSizee + (int)Math.Round(PageResize); 
        CurrentPage = 3; 
        PageSizes = true; 
    } 
} 
 

Query 2 : Second using @ref =DefaultGrid to retrieve the values of PageSize and CurrentPage it seems they are not correctly updated 
We are not able to reproduce the reported problem. The proper values are updated for the “PageSize”  and “CurrentPage” properties. Please find the screenshot below, 

 

We suspect that the problem may be because of using older version scripts in your application. So we suggest you to use the latest version(17.2.47) script in your application. 

 


Please get back to us if you need further assistance. 

Regards, 
Renjith Singh Rajendran. 



RZ Riccardo Zucchetto August 29, 2019 10:09 AM UTC

Hi Renjith Singh Rajendran,
Using the OnLoad now I can open the Grid with my custom values of paging correctly set.
If I modify the values of CurrentPage and PageSize the Grid is correctly refreshed, but reverse operation is still not working. What I mean is: if I use the native control pager to change page or pagesize, bound values of CurrentPage and PageSize are not updated.
More in detail my operations are:
1) After first load of the grid using log button values are: current page = 3 and page size = 5.
2) I change page from 3 to 4 using native control page by clicking either the arrow or directly the number
3) Check again with log button, and values are the same as before.

I uploaded an image describing the situation

Thank you,
Riccardo

Attachment: paging_6b21ecaf.zip


RN Rahul Narayanasamy Syncfusion Team August 30, 2019 10:17 AM UTC

Hi Riccardo, 

Thanks for your update. 

Query: PageSize and CurrentPage not updating 

We have checked the reported problem by following the steps mentioned by you. We are able to reproduce the reported problem at our end and also we have logged defect “Unable to get the updated values of PageSettings properties using grid instance” report for the same. Thank you for taking the 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 defect fix in our next Nuget release which is expected to be roll out on September 16, 2019.  
  
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. 


Till then we appreciate your patience. 

Regards, 
Rahul 



RZ Riccardo Zucchetto August 30, 2019 12:08 PM UTC

Hi Rahul,

I'll wait for the fix.

Thank you,
Riccardo


RS Renjith Singh Rajendran Syncfusion Team September 12, 2019 08:58 AM UTC

Hi Riccardo, 

We regret for the inconvenience caused.  

Due to some unforeseen circumstances, we will not be able to include the fix for this issue “Unable to get the updated values of PageSettings properties using grid instance” in our upcoming September 16, 2019 release. It will be fixed and included in our subsequent Nuget release which is expected to be rolled out by the end of September 2019.  

Until then we appreciate your patience. 

Regards,  
Renjith Singh Rajendran. 




RZ Riccardo Zucchetto September 12, 2019 09:01 AM UTC

Hi Renjith,
Thank you for your update.

Riccardo


VN Vignesh Natarajan Syncfusion Team September 13, 2019 12:50 PM UTC

Hi Riccardo,  

Thanks for the update.  

We will get back to you, once our Nuget package is successfully rolls out.     

Regards, 
Vignesh Natarajan. 



WA Walter March 28, 2020 01:05 PM UTC

Hi , I Have the same issue with version 18.1.0.36 


VN Vignesh Natarajan Syncfusion Team March 30, 2020 09:06 AM UTC

Hi Walter, 
 
Thanks for contacting Syncfusion forums. 
 
Query: “I Have the same issue with version 18.1.0.36  
 
As per your suggestion we have prepared  a sample using our latest version 18.1.0.36. And on a button click we have tried to get the Grid’s current page and page size. We are able to get the details from page settings using Grid instance. We are not able to reproduce the reported issue at our end.  
 
Refer the below code example.  
 
<h1>CurrentPage: @Pager</h1> 
<h1>PageSize: @PagerCount</h1> 
  
<SfButton OnClick="Clik">Get Page Details</SfButton> 
  
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true"><GridPageSettings PageSizes="true" PageSize="5"></GridPageSettings>
    <GridColumns> 
        <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
        <GridColumn Field=@nameof(Order.CustomerID) HeaderText="Customer Name" Width="150"></GridColumn> 
        <GridColumn Field=@nameof(Order.OrderDate) HeaderText=" Order Date" Format="d" Type="ColumnType.Date" TextAlign="TextAlign.Right" Width="130"></GridColumn> 
        <GridColumn Field=@nameof(Order.Freight) HeaderText="Freight" Format="C2" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
    </GridColumns> 
</SfGrid> 
  
@code{ 
    SfGrid<Order> Grid { getset; } 
    public List<Order> Orders { getset; } 
    public int Pager; 
    public int PagerCount; 
    . . . .. . .  
    public void Clik() 
    { 
        Pager = Grid.PageSettings.CurrentPage; 
        PagerCount = Grid.PageSettings.PageSize; 
    } 
} 
 
 
For your convenience we have attached the sample which can be downloaded from below  
 
 
If you are still facing the issue kindly get back to us with more details about your issue.  
 
Regards,
Vignesh Natarajan.
 


Loader.
Live Chat Icon For mobile
Up arrow icon