igniteui-angular
igniteui-angular copied to clipboard
`TransactionService.commit()` but keep undos?
Question
Hi -- the scenario I'm targeting is, a user makes a bunch of edits to multiple rows in a grid, clicks save, and realizes they made a mistake--so they want to click undo. Currently, my save button calls TransactionService.commit()
, which seems to wipe the undo stack. Is it possible to keep the undos so my user can revert to the state before the save? Thanks!
- igniteui-angular version:
- browser:
@SkylerLutz The behavior that you observe is the expected for the Transaction service - this is how it was designed to work. Every time the user executes an operation (transaction), it is added to the transaction log and undo stack. Committing the changes affects (updates) the underlying data. So we are not able to simply undo the commit as every future update of the underlying data would mean a new commit. Furthermore, the service does not save information on past operations. You can see more detailed information on our Transaction Service in our help topics.
@dafo I see -- thanks. Microsoft Word lets me undo after saving and I'd like to implement something similar -- can you think of any clever ways? Perhaps with two TransactionServices?
@SkylerLutz You can try such implementation, however do not expect it to be a simple for implementation solution. Have in mind that the transactions that your "second" Transaction Service would keep will give you the diff state compared to the original state of the underlying data, not compared to the current state. Give it a try and let us know if you face any troubles while implementing the desired behavior.
@dafo thanks! While I work on that can you please mark this as a feature request? Thanks
@SkylerLutz Just an idea for another approach (not that it would be easier). You can try creating your custom Transaction Service, where the "pending changes" are kept permanently and undo functionality is available on them. However, this will introduce issues similar to the previous approach - you would again need to manage the state of the underlying data. Here is a read on our Transaction Service implementation where you can find something useful if you decide to try creating a custom Transaction Service. However, this is just another idea and not a recommendation.
There has been no recent activity and this issue has been marked inactive.
There has been no recent activity and this issue has been marked inactive.
There has been no recent activity and this issue has been marked inactive.
There has been no recent activity and this issue has been marked inactive.
There has been no recent activity and this issue has been marked inactive.
There has been no recent activity and this issue has been marked inactive.
There has been no recent activity and this issue has been marked inactive.
There has been no recent activity and this issue has been marked inactive.
There has been no recent activity and this issue has been marked inactive.