0
votes

I would like to request help for design something in Oracle Apex.

Our Apex users can add or delete new row to tables in a page. Also after they making addition they got cancel button to the whole page. The cancel button suppose to bring everything to it's previous state. E.g delete added rows, un-delete deleted rows, undo change of rows..

My solution now is adding another column (Hidden) to the database, which handles the row state, but it's not clean, and not working perfectly.

I'll be happy for new ideas, whether is DB related or Apex related, Thanks.

enter image description here

1
Have you considered using an Interactive Grid ? In the interactive grid a user can add row(s) but then cancel and the row(s) will not be saved to the database. It does what you describe but it requires almost no dev work.Koen Lostrie
@KoenLostrie The thing is, we might have many tables in one page, so we have general "cancel" button for the whole page, not only for this specific table.Izik
Pls update your question. You did not mention multiple tables, you say "a table". Also, what exactly is "Cancel" ? Is it revert last transaction ? Revert last x transactions by that user ? What if another user has updated a rows since the current user has added it, can that be cancelled as well ? How are rows being added, is the page being submitted more than once ? How long can a user redo what he did ? Can he cancel something that he did yesterday ? That solution with the hidden column you describe - what does that do exactly ? I don't see how that would enabled this functionalityKoen Lostrie
It is common practice to use APEX collections for this sort of thing. Before first showing the page, populate APEX collections with a copy of the existing data from the real tables. Let the user add, delete and update rows in the APEX collections. The Save button would then invoke a process to make the corresponding changes to the real tables, and Cancel would just leave without making any changes,Tony Andrews
@KoenLostrie I changed from 'table' to 'tables. Other then that the question is pretty clear, I specified the cancel option is done on the whole page, not on table.Izik

1 Answers

1
votes

It is common practice to use APEX collections for this sort of thing. Before first showing the page, populate APEX collections with a copy of the existing data from the real tables. Let the user add, delete and update rows in the APEX collections. The Save button would then invoke a process to make the corresponding changes to the real tables, and Cancel would just leave without making any changes,