how could I call Richfaces.showModalPanel from my Managed Bean?

2.1k views Asked by At

Is there any possibility to do this call from my action return?

For example:

public String myActionMethod() {
     // do some stuff here..

     return "Richfaces.showModalPanel('myModal')";
} 
1

There are 1 answers

1
kolossus On

If conditionally showing the modal panel is your main requirement, look into the showWhenRendered(show in RF4.x popupPanel) attribute of the richfaces modalPanel component. Bind the showWhenRendered attribute to a boolean value in the backing bean and set the value to reflect the decision to display the popup.

To reflect changes on the modalPanel however, it is advisable to encase the modalPanel itself in an <a4j:outputPanel layout="none"/> container and then reRender that panel between requests. For Richfaces 3.3 at least, reRendering dynamically displayed components doesn't work that well if it's not encased in another <a4j:outputPanel layout="none"/>.

Besides the above, I'm not aware of Richfaces explicitly providing server-side remoting of client-side components (like Primefaces does with the RequestContext object)