I write solutions to the problems I can't find much about elsewhere on the Web, also some code/script snippets that are absolutely awesome and make my life easier. Will be glad if someone finds these posts interesting and helpful!

Monday, May 3, 2010

How to add showPopupBehavior to an ADF Rich Faces table column

I didn’t see the answer to that anywhere in the manual, so I had to experiment myself. Ofc I sort of figured out how to do it pretty easily. Still this tutorial can save someone’s time, I hope.
So, basically, what one can do to pop a dialog with ADF Rich Faces, is 2 simple steps:
1. Define a popup with a dialog in it
2. Set showPopupBehavior of the link or button to point to that popup.

Pretty simple, isn’t it? Now the question is how to achieve the same behavior per row in a table. If we set the same showPopupBehavior popupId to a command object found in a column, it won’t work and JDeveloper will mark it as an erroneous syntax (“Reference Id confirmDelete not found”). Well, the trick is that the popup should be defined inside the column, and that’s actually it. Here’s a code snippet.

The method in the backing bean looks like:

The navigation part is intended to refresh the page (there’s a global rule in the faces-config.xml for outcome “scheduler” to navigate to this page), because dialog handler doesn’t do it automatically with JSF controller.
Hope this helps!

No comments:

Post a Comment