julian CR
julian CR

Reputation: 33

primefaces: how to show an overlayPanel when a task finishes

I'm trying to show an overlayPanel after a java code is executed

something like this:

<p:commandButton id="btn" type="submit" actionListener="#{document.doSomething}" ajax="true"/>

<p:overlayPanel showEvent="oncomplete" for="btn"  appendToBody="true"> 
....                    
</p:overlayPanel>

I'd like the overlayPanel to be shown after document.doSomething finish.

I'm trying in many ways, but I can't. If I change the "oncomplete" ShowEvent by "click", then the panel is shown, but before document.doSomething finish.

How can I achieve this?

Thanks in advance

Upvotes: 0

Views: 2130

Answers (1)

Konrad
Konrad

Reputation: 36

Try to make booleanProperty in bean, and render OverlayPanel ... in dosomething() remember to set booleanProperty to true, and update overlayPanel like this:

<p:commandButton id="btn" type="submit" actionListener="#{document.doSomething()}" ajax="true" update="overlayPanelId"/>

<p:overlayPanel id= "overlayPanelId" showEvent="oncomplete" for="btn"  appendToBody="true"         rendered="#{document.booleanProperty}"> 

</p:overlayPanel>

in bean:

private boolean booleanProperty;
getters,
setters

dosomething(){  
something.....
setBooleanProperty(true);
}

Upvotes: 1

Related Questions