Skip to main content
Solved

How to Undo in Data Entry grids?


aaghaei
Captain II
Forum|alt.badge.img+9

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

Best answer by aaghaei

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);
    }
}

 

View original
Did this topic help you find an answer to your question?

13 replies

Forum|alt.badge.img+3

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.


aaghaei
Captain II
Forum|alt.badge.img+9
  • Author
  • Captain II
  • 1178 replies
  • July 24, 2022

@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?


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • July 25, 2022

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.

 

 


aaghaei
Captain II
Forum|alt.badge.img+9
  • Author
  • Captain II
  • 1178 replies
  • July 25, 2022

@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


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • July 25, 2022

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


aaghaei
Captain II
Forum|alt.badge.img+9
  • Author
  • Captain II
  • 1178 replies
  • July 25, 2022

@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:
 

 


Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • July 25, 2022

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.


aaghaei
Captain II
Forum|alt.badge.img+9
  • Author
  • Captain II
  • 1178 replies
  • July 25, 2022

@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.


aaghaei
Captain II
Forum|alt.badge.img+9
  • Author
  • Captain II
  • 1178 replies
  • July 25, 2022

@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);
        }

 


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2640 replies
  • October 28, 2022

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


aaghaei
Captain II
Forum|alt.badge.img+9
  • Author
  • Captain II
  • 1178 replies
  • October 28, 2022

Hi @Chris Hackett  No unfortunately


aaghaei
Captain II
Forum|alt.badge.img+9
  • Author
  • Captain II
  • 1178 replies
  • Answer
  • October 29, 2022

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);
    }
}

 


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2640 replies
  • October 29, 2022

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings