Events and agruments on page navigation

In my project most data tables are complicated and I should use List<ExpandoObject> data source. Additionally many tables are very large. It force to make write my own operations for search, filtering, sort and paging and to make some kind of cashing for loaded data.
In ActionBegin event I choose Action and check if I need to load new data. For sorting it is:

        if (args.RequestType == Syncfusion.Blazor.Grids.Action.Sorting)
        {
            Cursor.Sorts = new List<Sort> { new Sort { Name = args.ColumnName, Direction = nameof(SortDirection.Ascending) } };
            DataSource = await DataCRUD.ReadAsync(Cursor).ConfigureAwait(true);
        }

I have some difficulty only with Paging. I found args.CurrentPage and PreviousPage. I can reach Grid.PageSettings.PageSize for previous page size. But when page size is changing, ActionBegin fires, but new Page size is not shown in args.

Question is if the ActionBegin event is write place to make datasource changes under grid navigation? If yes, where to find new page size under paging when page size is changed?

1 Reply 1 reply marked as answer

RN Rahul Narayanasamy Syncfusion Team June 3, 2020 01:13 PM UTC

Hi Stanislav, 

Greetings from Syncfusion. 

Query: where to find new page size under paging when page size is changed? 

We have validated your query and you want to get the newly changed PageSize after changing PageSize in pager. You can get the PageSize by using below way. Find the below code snippets and sample for your reference. 

 
    <SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true"> 
        <GridPageSettings PageSizes="true"></GridPageSettings> 
        <GridEvents OnActionBegin="ActionBeginHandler" TValue="Order"></GridEvents> 
        <GridColumns> 
            <GridColumn Field=@nameof(Order.OrderID) HeaderText="Order ID" TextAlign="TextAlign.Right" Width="120"></GridColumn> 
            . . . 
       </GridColumns> 
    </SfGrid> 
 
@code{ 
    SfGrid<Order> Grid; 
    ... 
   public async void ActionBeginHandler(ActionEventArgs<Order> args) 
    { 
        await Task.Delay(300); 
        var NewPageSize = Grid.PageSettings.PageSize; 
    } 
} 


Please get back to us if you need further assistance. 

Regards,
Rahul 


Marked as answer
Loader.
Up arrow icon