OnToolbarClick="@toolbarClickHandler">
public void toolbarClickHandler(Syncfusion.EJ2.Blazor.Navigations.ClickEventArgs args)
{
// Here you can customize your code
}
<EjsGrid DataSource="@gridData" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })" OnActionComplete="@actionCompletedHandler">
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="@EditMode.Normal"></GridEditSettings>
<GridPageSettings PageSize="5"></GridPageSettings>
<GridColumns>
...
</GridColumns>
</EjsGrid>
@functions{
public List<OrdersDetails>
gridData { get; set; }
protected override void OnInit()
{
gridData = OrdersDetails.GetAllRecords();
}
public void actionCompletedHandler(ActionEventArgs args)
{
if(args.RequestType.ToString() == "Save")
{ //you can get edited data by using args.Data
var data = JsonConvert.DeserializeObject<OrdersDetails>(JsonConvert.SerializeObject(args.Data)); //for getting serialized data
// Here you can process your operation to store database
}
}
} |
|