Hi team,
I want to put the batch saving (detail) and saving of Master Entry in 1 method / customized button.
How can I call
Ex. OnBatchSave(BeforeBatchSaveArgs
or args.BatchChanges.ChangedRecords in another method?
Razor
Code Block
public void OnSaveDetail(BeforeBatchSaveArgs
{
var BatchChanges = Args.BatchChanges;
if (BatchChanges.AddedRecords.Count > 0)
{
//Insert data into your database
}
if (BatchChanges.ChangedRecords.Count > 0)
{
//update changes into your database
}
if (BatchChanges.DeletedRecords.Count > 0)
{
//delete record from your database
}
}
public void SaveRecord()
{
SaveHeader(); //for Master
OnSaveDetail
(How can I pass the "
BeforeBatchSaveArgs
}
|
@using Syncfusion.Blazor.Grids
<button @onclick="UpdateExternally">Update</button>
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Delete", "Update", "Cancel" })">
<GridEvents OnBatchSave="BatchSaveHandler" TValue="Order"></GridEvents>
<GridEditSettings AllowAdding="true" AllowDeleting="true" AllowEditing="true" Mode="EditMode.Batch"></GridEditSettings>
<GridColumns>
..
</GridColumns>
</SfGrid>
@code{
public List<Order> Orders { get; set; }
SfGrid<Order> Grid { get; set; }
public async Task UpdateExternally()
{
await Grid.EndEdit();
}
public void BatchSaveHandler(BeforeBatchSaveArgs<Order> args)
{
}
} |
Thanks a lot Jeeva. It works now.