I am having trouble figuring out how to cancel changes made to a record in a popup window. Here's the scenario:
- Main window has a table showing records from a user table.
- At bottom are several buttons. Two of them (Add, Edit) bring up a popup window.
- When the popup is opened as a result of the Edit button being clicked it shows the content of the selected row from the table.
- The popup has two buttons: OK & Cancel.
- The OK button should close the popup and automatically "update" the Main window's selected row.
- The Cancel button should "undo" all changes made to record and then close the popup.
I've gotten everything but the last part to work. When the Edit button on the Main window is clicked I bind the selected entry to a context element and the bind that element to the popup window. I'll be glad to provide the code if that'll help someone give me an answer.
If I click OK on the popup it just closes the window and the changes automatically are displayed in the selected row.
One option I thought of was to just save the original row element somewhere and then revert to it if Cancel is clicked. HOwever, before I go down that road I wondered if there was some built-in functionality I can take advantage of or if there was a recommended way of handling this issue.
Thanks in advance for any help.