|
<SfGrid @ref="Grid" TValue="Order" AllowFiltering="true" AllowSorting="true" AllowPaging="true" Toolbar="@( new List<string> {"Add", "Edit","Delete","Update","Cancel" })">
<GridFilterSettings Type="Syncfusion.Blazor.Grids.FilterType.Menu"></GridFilterSettings>
<GridPageSettings PageSize="4"></GridPageSettings>
<GridEvents OnActionBegin="BeginHandler" TValue="Order"></GridEvents>
<GridEditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true"></GridEditSettings>
<SfDataManager Url="http://localhost:64956/odata/books" Adaptor="Adaptors.ODataV4Adaptor"></SfDataManager>
<GridColumns>
. . . . .. . .
</GridColumns>
</SfGrid>
@code{
SfGrid<Order> Grid { get; set; }
public async Task BeginHandler(ActionEventArgs<Order> Args)
{
if(Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
{
await Task.Delay(200); // wait till save action gets completed
double result = (double)(Grid.TotalItemCount + 1) / Grid.PageSettings.PageSize; //calculating the page where record is inserted
await Grid.GoToPage(Math.Ceiling(result)); // navigate to that page
}
}
}
|