BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi,
Is there any option to create multiple rows at once in a grid in batch edit mode? I mean, if I need to create 20 rows, should I call to Grid.AddRecordAsync() 20 times?
Thanks!
David
Hi David,
Query:” Is there any option to create multiple rows at once in a grid in
batch edit mode? I mean, if I need to create 20 rows, should I call to
Grid.AddRecordAsync()”
yes, you can use the AddRecordAsync method to create multiple rows at once in
batch edit mode. However, to ensure that the added data is stored on the
datasource using batch editing, you need to call the EndEditAsync() method. We
have created a simple sample that you can refer to. Please find the attached
code snippet and sample for your reference.
<SfButton @onclick="AddRecord">AddData</SfButton>
<SfGrid @ref="Grid" TValue="Order" DataSource="@Orders"> <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" ShowConfirmDialog="false" Mode="EditMode.Batch" ></GridEditSettings> </SfGrid> {
await Grid.AddRecordAsync(new Order() { OrderID = orderId, CustomerID = "New", Freight = 223.2, OrderDate = DateTime.Now }); orderId++; await Grid.EndEditAsync();
} |
Reference: https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_AddRecordAsync
https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.Grids.SfGrid-1.html#Syncfusion_Blazor_Grids_SfGrid_1_EndEditAsync
Regards,
Prathap S
Thanks! However, the example is not exactly what I'm looking for. I ask for multiple rows creation in a single button click. In that case, should I create a loop and call to AddRecordAsync() n times or is there some method that accepts a list of rows to add to the grid?
Thanks for the update,
Query: "Is there some method that accepts a list of rows to add to the grid?"
We regret to inform you that currently, we don’t have a list of the data added to the grid instance method. Instead, we suggest using a loop to add the data using AddRecordasync() method. Please get back to us if you have any further queries.