You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have having a time trying to implement a confirm message when the user attempts to delete a row. I have RowRemoving="@OnRowRemoving" in the DataGrid.
Here is the code:
@inject IJSRuntime JsRuntime
private Action<CancellableRowChange<CaseRec>> OnRowRemoving = o =>
{
o.Cancel = DeleteCase(o.Item.EmployeeName); // can't call non-static method
};
private bool DeleteCase(string id) // If this is static, then I can't use JsRuntime
{
bool confirmed = JsRuntime.InvokeAsync<bool>("confirm", "Are you sure?").Result;
if (confirmed)
{
return true;
// Delete!
}
return false;
}
The text was updated successfully, but these errors were encountered:
I tried it on my side and the problem is that you're calling async code from synchronous method. To make it work I will have to convert RowRemoving to EventCallback that can supports async.
I have having a time trying to implement a confirm message when the user attempts to delete a row. I have RowRemoving="@OnRowRemoving" in the DataGrid.
Here is the code:
The text was updated successfully, but these errors were encountered: