Im not sure if this behaviour is normal or not.
Im hoping that my panel
will be rendered only after clicking on a button that triggers an ajax
request.
Not using Ajax works fine :
p:panel id="myPanel" rendered="#{myBean.flag}"
p:commandButton ajax="false" action="#{myBean.setFlagToTrue}"
(flag = false)
Using ajax fails :
p:panel id="myPanel" rendered="#{myBean.flag}"
p:commandButton ajax="true" action="#{myBean.setFlagToTrue}" update="myPanel"
(flag = false)
I've tried omitting the rendered attribute, and indeed the ajax works fine.
I can tell that by looking at the changes reflected inside the panel.
put your panel with conditional rendering inside another and update it. Like this:
<p:outputPanel id="toUpdate">
<p:panel id="myPanel" rendered="#{myBean.flag}">
</p:panel>
<p:outputPanel>
<p:commandButton update="toUpdate"/>
This is a known issue. The element can't be updated if it doesn't exist in DOM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With