|
<SfGrid @ref="@GridInstance" DataSource="@People"> <GridEvents CellSaved="CellSaveHandler" TValue="Person"></GridEvents>
...
</SfGrid>
@code{
SfGrid<Person> GridInstance { get; set; }
...
public void CellSaveHandler(CellSaveArgs<Person> args)
{
// Save batch here?
GridInstance.EndEdit();
}
...
}
|
Hello, is there a way to solve this same problem in Dialog edit mode? Thank you.
Hi Dave,
Greetings from Syncfusion support.
Query: “is there a way to solve this same problem in Dialog edit mode? Thank you.”
We want to clarify that solution provided in this update is for Batch editing where changes of a particular cell are saved in batch mode and get updated in Grid upon the Update button click. But dialog editing is row-based editing where the entire row is considered and changes get saved in a grid upon clicking the Update or Save button of the Grid edit dialog.
As we are unaware of the issue you are
facing, we need some more details about your requirement or problem you are
facing. So kindly share more information on this to proceed further.
Regards,
Vignesh Natarajan
Vignesh, thank you for your reply. I'd like the functionality the original poster was asking for (saving a change to a cell automatically--i.e., after losing focus with tab, enter, etc. No save button.). However, I'd like to have that functionality in a dialog rather than in the grid. Is this possible?
Hi Dave,
Before proceeding further with your requirement we need some more clarification. Kindly share us the below details to proceed further.
Also we would like to inform that we have support to prevent the data cloning using PreventDataClone property inside OnActionBegin event. It will save the edited data directly to the DataSource and we suggest you to call grid refresh method at the time of closing the SfDialog and it will refresh the records in the DataGrid.
But when using PreventDataClone the edited values will be stored directly to the DataSource and we don’t have possibilities to retrieve the previous value.
|
<SfGrid DataSource="@Orders" @ref="Grid" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Update", "Cancel" })" Height="315"> <GridEvents OnActionBegin="OnActionBegin" TValue="Order"></GridEvents> <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Dialog">
<FooterTemplate>
<SfButton OnClick="@Cancel">Cancel</SfButton> </FooterTemplate> </GridEditSettings> <GridColumns> ... </GridColumns> </SfGrid>
@code { public List<Order> Orders { get; set; } public SfGrid<Order> Grid; public void Cancel() { Grid.Refresh();
} public void OnActionBegin(ActionEventArgs<Order> args) { if (args.RequestType.Equals(Syncfusion.Blazor.Grids.Action.BeforeBeginEdit)) { args.PreventDataClone = true; } }
} |
Reference :
https://blazor.syncfusion.com/documentation/datagrid/events#onactionbegin
Please check this suggestion from your side and get back to us if you need further assistance.
Regards,
Monisha