I have a button and a panel in primefaces. I want the panel to be visible when I press the button. How can I do it with primefaces?
I have the code
<p:commandButton value="Search" ajax="false"
actionListener="#{myBean.searchPatients}" onclick="panelwv.show();">
</p:commandButton>
<p:panel widgetvar="panelwv" visible="false" closable="true" toggleable="true" >
but it does not work
You have a typo in your code, the attribute you need is widgetVar
:
<p:commandButton value="Search" ajax="false"
actionListener="#{myBean.searchPatients}" onclick="panelwv.show();">
</p:commandButton>
<p:panel widgetVar="panelwv" visible="false" closable="true" toggleable="true"/>
If you don't want to render your panel at all you should consider using the rendered
attribute of the component.
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