Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

show panel when button is pressed

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

like image 872
loubas Avatar asked Oct 15 '12 19:10

loubas


1 Answers

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.

like image 190
Akos K Avatar answered Nov 14 '22 15:11

Akos K