|
<SfGrid @ref="Grid" DataSource="@Data" TValue="OrderDetails" Toolbar="@(new List<string> {"Add","Edit","Delete","Update","Cancel","Search" })" AllowPaging="true">
<GridEvents OnActionBegin="OnActionBegin" TValue="OrderDetails"></GridEvents>
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>
...
</SfGrid>
@code{
SfGrid<OrderDetails> Grid { get; set; }
List<OrderDetails> Data { get; set; }
protected override async Task OnInitializedAsync()
{
Data = await OrderData.GetPeople();
}
public async void OnActionBegin(ActionEventArgs<OrderDetails> Args)
{
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Save)
{
if (Args.Action == "add")
{
await OrderData.InsertOrderAsync(Args.Data); // handle add action here
}
else
{
await OrderData.UpdateOrderAsync(Args.Data.OrderID, Args.Data); // handle edit action here
}
}
if (Args.RequestType == Syncfusion.Blazor.Grids.Action.Delete)
{
await OrderData.DeleteOrderAsync(Args.Data.OrderID); // handle delete action here
}
}
} |
Hi,thanks for the demo, it works after edit it triggers the OnActionEvent method, and sends the data to my API and data is saved on the server.But now I have a stupid problem after that Modal edit window doesn't close, it stays open. I even tried with inline editing,the same thing, data saved, but it doesn't exit from edit mode.There is no error shown, only in modal case, the window doesn't close and in the case of inline, it stays in edit mode.Also I tried with API line commented but same thing.In your demo it works Ok, really don't understand the problem. I bet it's something so simple but I can't see it.Also I noticed that OnActionComplete, never triggers. In your demo yes
|
<SfGrid @ref="Grid" DataSource="@Data" TValue="OrderDetails" Toolbar="@(new List<string> {"Add","Edit","Delete","Update","Cancel","Search" })" AllowPaging="true">
<GridEvents OnActionBegin="OnActionBegin" OnActionComplete="OnActionComplete" TValue="OrderDetails"></GridEvents>
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="Syncfusion.Blazor.Grids.EditMode.Dialog"></GridEditSettings>
<GridColumns>
<GridColumn Field="@nameof(OrderDetails.OrderID)" HeaderText="Order ID" IsPrimaryKey="true" TextAlign="TextAlign.Right" Width="120"></GridColumn>
<GridColumn Field="@nameof(OrderDetails.CustomerID)" HeaderText="Customer ID" Width="150"></GridColumn>
</GridColumns>
</SfGrid> |
|
|