Undo Editing Changes in Prime Faces Editor

UI Components for JSF
Post Reply
javaarchjdr
Posts: 1
Joined: 10 Mar 2011, 06:22

10 Mar 2011, 06:32

I am using the editor on a jsf page to allow a client to make online changes to a page. When the client clicks on an edit button next to some text on the page, I use javascript to hide the text and show the editor that has the same text, along with a submit and cancel button. When the client clicks on the cancel button I hide the editor and redisplay the unchanged text - this works fine. But if the user has made any changes inside the editor prior to clicking on cancel, those changes will be displayed when the editor is reopened unless the client refreshes the screen. I would like to restore the content of the editor to its initial value when the client clicks on the cancel button w/o refreshing the screen. Any suggestions?

User avatar
kafsinkaf
Posts: 3
Joined: 23 Dec 2010, 16:35

10 Mar 2011, 12:06

For a similar need, I am copying properties of the 'selected' bean to be edited in the form to a temporary 'working' copy (using org.apache.commons.beanutils.PropertyUtilsBean.copyProperties method) and bind the form elements to this working copy. When the user updates are accepted, then update the selected bean from working copy again using the same approach and persist it, if needed.

I hope this approach helps you.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 54 guests