I need to perform my CRUD using the events.
The OnActionComplete event is not called for the "Delete" RequestType after deletion of a record in the ActionBegin event.
Short experimental code snippet:
<SfGrid TValue="Stuff"
DataSource="Items"
Toolbar="@(new List<string>() {"Add","Search"})">
<GridEditSettings AllowEditing="true" AllowAdding="true" AllowDeleting="true" Mode="EditMode.Dialog" ShowDeleteConfirmDialog="true"></GridEditSettings>
<GridEvents OnActionBegin="ActionBegin" OnActionComplete="ActionCompleted" TValue="Stuff"></GridEvents>
<GridColumns>
<GridColumn Field="@nameof(Stuff.Thing)"></GridColumn>
<GridColumn HeaderText="Editing" Width="150">
<GridCommandColumns>
<GridCommandColumn Type="CommandButtonType.Edit" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-edit", CssClass = "e-flat" })"></GridCommandColumn>
<GridCommandColumn Type="CommandButtonType.Delete" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-delete", CssClass = "e-flat" })"></GridCommandColumn>
<GridCommandColumn Type="CommandButtonType.Save" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-update", CssClass = "e-flat" })"></GridCommandColumn>
<GridCommandColumn Type="CommandButtonType.Cancel" ButtonOption="@(new CommandButtonOptions() { IconCss = "e-icons e-cancel-icon", CssClass = "e-flat" })"></GridCommandColumn>
</GridCommandColumns>
</GridColumn>
</GridColumns>
</SfGrid>
private async Task ActionBegin(ActionEventArgs<Stuff> obj)
{
if (obj.RequestType == Action.Delete)
{
await obj.Data.DeleteAsync();
}
if (obj.RequestType == Action.Save)
{
await obj.Data.SaveAsync();
}
}
private async Task ActionCompleted(ActionEventArgs<Stuff> obj)
{
if(obj.RequestType is Action.Save or Action.Delete) // RequestType Delete is never called after the delete
await LoadData();
}
Is this by design or perhaps a bug?
I think it's a bug. Because why won't you call ActionCompleted after the "D" Even