Load from server with paging on SfDatagrid

with "SfDatagrid", I can see in the samples that data was loaded on the start and than paging applied.  Is there any event that I can capture and reload the data for the specific page and size from the Server instead of loading it in one shot.  


Thanks in advance


1 Reply 1 reply marked as answer

RN Rahul Narayanasamy Syncfusion Team December 28, 2021 10:12 AM UTC

Hi Gopichandar, 

Greetings from Syncfusion. 

We have validated your query and you can achieve your requirement by using OnActionBegin event with RequestType as Paging of the Grid. Find the below code snippets and documentation for your reference. 

 
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true" AllowFiltering="true" 
        Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })"> 
    <GridPageSettings PageSize="8"></GridPageSettings> 
    <GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.CheckBox"></GridFilterSettings> 
    <GridEvents OnActionBegin="ActionBeginHandler" TValue="Order"></GridEvents> 
    <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Normal"></GridEditSettings> 
    <GridColumns> 
        . . . 
    </GridColumns> 
</SfGrid> 
 
@code{ 
    public List<Order> Orders { get; set; } 
    . . . 
    public void ActionBeginHandler(ActionEventArgs<Order> args) 
    { 
        if (args.RequestType.Equals(Syncfusion.Blazor.Grids.Action.Paging)) 
        { 
            //get the current page details using - args.CurrentPage 
            //get the previous page details using -args.PreviousPage 
        } 
    } 
    . ..  
} 


If it does not meet your requirement or if we misunderstood your requirement, then could you please share more details about your requirement. 

Regards, 
Rahul  



Marked as answer
Loader.
Up arrow icon