Prompting User for Unsaved data [message #1015265] |
Wed, 27 February 2013 22:53 |
Ronald So Messages: 198 Registered: April 2011 |
Senior Member |
|
|
I have a view that contains a lot of text fields. To prevent users from losing unsaved data when user navigates away from the current view, I need a mechanism to prompt the user if he/she really wants to navigate away from the current view. If user answers yes, unsaved data will be purged. Otherwise, user stays in the same view.
I know a ViewPart can implement ISaveablePart2 interface to set the "dirty" bit. I have no problem getting the asterisk next to my view name by firing a property change called PROP_DIRTY when I programmatically set the dirty bit to true when user starts entering data. However, I can't get the framework to call "promptToSaveOnClose()" method even when isDirty() returns true. Can anyone shed some light on that?
In addition, if I have the aforementioned problem solved, how can I get the behavior I am looking for? Consider this scenario. When user is editing in the current view, he/she clicks to a different perspective. A warning message is shown "You have unsaved data. Are you sure you want to leave this page?". User clicks Yes, a new view is shown and data is discarded. What if user clicks No and want to stay in the same view? How do I accomplish that?
Thanks,
Ronald
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01663 seconds