asked
2014-09-08 22:13:23 +0800
sgoli 0 I have an index.zhtml (with navigation header at the top) page which acts as a base container for the reamainaing pages in the project to load.
Lets say I have several zhtml pages. Suppose in page1.zhtml, I have a grid which allows for inline edits in one of the columns. There is a save changes button at the bottom of page1.zhtml. Once the user makes inline edits and click save changes button, the changes are persisted at the server side.
My question here is: If the user makes inline edit changes and forgot to save the changes and trying to navigate to a different page, I have to warn the user about the unsaved changes and user can either save or discard those changes. How would I know whether the user is navigating out of current page. Is there a way that SelectorComposer recognizes about navigating out of its layout page?
@Darksu,
Thanks for the response, I am providing the inline edit feedback to user about unsaved changes. There are multiple ways of navigating out of this page, from navigation bar/links. I just need to know programmatically when we are navigating out of the current page/composer.
Thanks for all the responses. Most of the responses are regarding detecting bean property changes. To keep it simple, I just want to prevent user from navigating from page1 to any other page, if the page1 has unsaved changes (through inline edits).
sgoli ( 2014-09-11 18:18:29 +0800 )editYou can try use javascript beforeUnload event to avoid navigation.
vincentjian ( 2014-09-12 07:48:04 +0800 )edit