Solved

How to Undo in Data Entry grids?


Userlevel 7
Badge +8

Does Acumatica have a built-in button to undo changes in Data Entry Grids?

icon

Best answer by aaghaei 29 October 2022, 02:17

View original

13 replies

Userlevel 5
Badge +2

Maybe I’m not fully understanding your question but to undo any changes on a page, just hit the Cancel button. If you want to undo changes to the current field (regardless of whether in a grid or not), just hit Escape.

Userlevel 7
Badge +8

@RoyceLithgo I’m not sure it is that easy. let say you have a master-detail form and you have made a bunch of changes in the form header and in the grid rows. Now you accidently in the grid hit the “Delete” key from your keyboard and system deletes that grid row. So how you undo the deleted row in the grid without losing all other changes you want to keep?

Userlevel 7
Badge +17

Hi, @aaghaei  I think we can not only undo a particular change. Please find the details below and hope this helps.

Once we started editing the changes like insert/delete/update the records and all these changes are available only in the Cache (Inserted/Deleted/Updated) blocks, once you click on the Undo/Cancel button Cache will be cleared (inserted/deleted/updated) data.

 

 

Userlevel 7
Badge +8

@Naveen Boga thank you for the explanation. That is what I thought. As you know in the grid “Delete” key is the equivalent of “-” button on top of the grid. Since it is not possible to undo just a specific change is it possible to disable “Delete” hot key press from keyboard or raise a dialog to confirm the deltion? In my case I only want to prevent from deleting when accidently “Delete” key pressed on the keyboard

Userlevel 7
Badge +17

@aaghaei  You just wanted to disable the (X) grid button from only Keyboard and also from the manual as well.

Userlevel 7
Badge +8

@Naveen Boga I couldn’t find any property to disable just “Delete” hot key from the keyboard and keep the “-” on the grid. Here is the Delete action properties:
 

 

Userlevel 7
Badge +17

Yes @aaghaei  We don’t have such a feature for deletion. 

You can show a warning message when the user trying to delete the item by writing the logic in the RowDeleting event.

But, this warning will be shown when user tries to delete the item from the keyboard and the (X) button click manually as well.

Userlevel 7
Badge +8

@Naveen Boga appreciated for the quick response. I see what you mean now. I have to test this out but I guess this will cause a bigger problem. I’m worried that user will see the delete confirmation dialog hundreds of times when they try to delete a document. The Cost Projection usually has a few hundred rows when initilized and in case someone wants to delete it they will have to confirm line by line.

As a work around I may end up adding a flag to document header to show the deletion dialog based on that flag. Or you might have a better suggestion.

Userlevel 7
Badge +8

@Naveen Boga 

Here I added an event handler but either I click on Yes or No, system anyways deletes the record. What I’m doing wrong?

        protected void PMCostProjectionLine_RowDeleting(PXCache cache, PXRowDeletingEventArgs e, PXRowDeleting InvokeBaseHandler)
{
var row = e.Row as PMCostProjectionLine;

if (row == null) return;

if (Base.Details.Ask(PMMessages.DeleteCostProjectionLine, MessageButtons.YesNo) != WebDialogResult.Yes) return;

if (InvokeBaseHandler != null) InvokeBaseHandler(cache, e);
}

 

Userlevel 7
Badge

Hi @aaghaei - were you ever able to find a solution? Thank you!

Userlevel 7
Badge +8

Hi @Chris Hackett  No unfortunately

Userlevel 7
Badge +8

Hi @Chris Hackett 

Considering it wasn’t an urgent need I was postponing it. I just gave it another try as follows and made it work.

protected virtual void PMCostProjectionLine_RowDeleting(PXCache cache, PXRowDeletingEventArgs e, PXRowDeleting BaseHandler)
{
var row = e.Row as PMCostProjectionLine;
if (row == null) return;
if (Base.Details.Ask(PMMessages.DeleteCostProjectionLine, MessageButtons.YesNo) != WebDialogResult.Yes)
{
e.Cancel = true;
return;
}
else
{
BaseHandler?.Invoke(cache, e);
}
}

 

Userlevel 7
Badge

Awesome! Thank you for sharing your solution with the community @aaghaei !

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved