Hi team,
I have a Grid and the mode is set to Batch EditType. This is working fine where i can make changes to multiple cells and rows. Once I am done with the changes and when I hit on Update button I decided not to save the changes hence clicked on Cancel button on the confirmation Dialog , the changes made should have been undone which is not happening. I had to hit on Cancel button again on the Toolbar to cancel all the changes i made.
Is this an expected behavior? My user wants to undo the changes when they hit on cancel button on the confirmation dialog. Please advice.
Hi Baba,
Greetings from Syncfusion.
You want to revert the changes while clicking the Cancel button on the save confirmation dialog after performing changes in batch mode. While clicking on the Cancel button in the Save confirmation dialog, it only prevents the save operation and it will maintain the previously changes values. If you want to discard the changes, then you need to Click the Cancel button in the toolbar to discard the changes. This is the default behavior.
Please let us know if you have any concerns.
Regards,
Rahul
Hello Rahul,
Yes If I click on the Cancel button on Toolbar, the changes are reverted. But don't you think the user has to do another step/click to cancel the changes? When the save confirmation dialog comes up its kind of misleading message.
It say's Are you sure you want to save the changes. And it presents Ok and Cancel button.
The user when clicks on Cancel button, expects that the changes he made will be reverted. So what is the functionality of Cancel button on this confirmation dialog? It's used only to close the confirmation dialog and keep the changes as is?
Thanks
Baba
Hi Baba,
Thanks for the update.
As we said in our previous update while clicking on the Cancel button in the Save confirmation dialog, it only prevents the save operation and it will maintain the previously changes values. If you want to discard the changes, then you need to click the Cancel button in the toolbar to discard the changes. This is the default behavior.
If you still want to remove the previously edited values while clicking on the Cancel button in the Save confirmation dialog, then we suggest you to achieve your requirement by using external dialog with Grid methods. Here, we have prepared a simple sample based on requirement. Find the below code snippets and sample for your reference.
|
<SfGrid @ref="Grid" DataSource="@Orders" AllowPaging="true" Height="200" Toolbar="Toolbaritems"> <GridEvents OnToolbarClick="ToolbarClickHandler" TValue="Order"></GridEvents> <GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="EditMode.Batch" ShowConfirmDialog="false"></GridEditSettings> <GridColumns> . .. </SfGrid>
<SfDialog Width="250px" ShowCloseIcon="true" IsModal="true" @bind-Visible="@IsUpdateVisible"> <DialogTemplates> <Content> Are you sure you want to save changes? </Content> </DialogTemplates> <DialogButtons> <DialogButton Content="OK" IsPrimary="true" OnClick="@OkClickUpdate" /> <DialogButton Content="Cancel" OnClick="@CancelClickUpdate" /> </DialogButtons>
</SfDialog>
. ..
@code{ SfGrid<Order> Grid; public List<Order> Orders { get; set; } private List<Object> Toolbaritems = new List<Object>() { "Add", "Edit", "Delete", new ItemModel() { Text = "Update", TooltipText = "Update", PrefixIcon = "e-click", Id = "UpdateClick" }, new ItemModel() { Text = "Cancel", TooltipText = "Cancel", PrefixIcon = "e-cancel-click", Id = "CancelClick" }}; . ..
public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args) {
if (args.Item.Id == "UpdateClick") { IsUpdateVisible = true; } if (args.Item.Id == "CancelClick") { IsCancelVisible = true; } }
private bool IsUpdateVisible { get; set; } = false; private bool IsCancelVisible { get; set; } = false;
private async Task CancelClickUpdate() { this.IsUpdateVisible = false; await Grid.CloseEditAsync(); } private async Task OkClickUpdate() { this.IsUpdateVisible = false; await Grid.EndEditAsync(); }
. . . }
} |
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample-317756513
Please let us know if you have any concerns.
Regards,
Rahul
Hello Rahul,
Thank you for the update and the sample. I am running this requirement with my usability team. Based on their input I will go ahead with the changes.
Thanks again,
Baba
Hi Baba,
Thanks for the update.
We will wait to hear from you. Please get back to us if you need further assistance.
Regards,
Rahul