Hey,
I follow your documentation Datagrid-LoadData. I would like to try it with CRUD but there is a problem if I add a new row:
Order.razor
<button class="button is-outlined" @onclick="@(args => InsertRow())">Add</button> <RadzenGrid AllowFiltering="true" AllowPaging="true" AllowSorting="true" TItem="Order" Data="@Orders" LoadData="@LoadData" EditMode="DataGridEditMode.Single" RowCreate="@OnCreateRow" RowUpdate="@OnUpdateRow" @ref="ordersGrid" Count="@Count" > <Columns> columns here... </Coulmns> </RadzenGridColumn>
My Code-Behind file:
public int Count { get; set; }
public IEnumerable<Order> Orders{ get; set; }
private async Task InsertRow()
{
await ordersGrid.InsertRow(new Order());
}
private async Task CancelEdit(Order order)
{
ordersGrid.CancelEditRow(order);
await ordersGrid.Reload();
}
async Task LoadData(LoadDataArgs args)
{
Orders = await service.GetAll();
Count = Orders .Count();
await InvokeAsync(StateHasChanged);
}
void OnCreateRow(Order order)
{
}
async Task OnUpdateRow(Order order)
{
await ordersGrid.Reload();
}
The method 'InsertRow()' gets called (checked in debug) but no new row is shown in the DataGrid. If I remove the 'LoadData="@LoadData" attribute a new row will be inserted into the DataGrid and I can edit the new row (the behaviour like in the DataGrid-inline example)
Thank you in advance.