Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can 'update' attribute update two components simultanously?

Tags:

jsf

primefaces

I have a question. Is that possible to update two components at a time? I am trying a code like this:

<h:panelGroup id="pickList">
    <p:panel  rendered="#{customCalender.visible}" widgetVar="searchTableBox">

    //Some codes.....

        <p:commandButton value="Cancel" update="pickList" actionListener="#{customCalender.closeList}" style="background:#25A6E1;color:red;font-family:'Helvetica Neue',sans-serif;font-size:10px;border-radius:4px;" />
        <p:commandButton value="Save" update="custDataTablePanel" actionListener="#{customCalender.saveTargetList}" style="background:#25A6E1;color:red;font-family:'Helvetica Neue',sans-serif;font-size:10px;border-radius:4px;"/>
   </p:panel>
</h:panelGroup>
....
.....
<h:panelGroup  id="custDataTablePanel">
   <p:panel rendered="#{customCalender.dataTableVisible}">
..
..
   </p:panel>
</h:panelGroup>

Now I want when I click on the Save button it hides the <h:panelGroup id="pickList"> and displays the <h:panelGroup id="custDataTablePanel"> so I have two boolean values to control their visibility. but I need to update two of these panels. One I did with update="custDataTablePanel" it displays the data table after the button click.(in the method saveTargetList I updated the visibility of the custDataTablePanel to true.) but cant manage to hide the panel pickList.

So I was wandering is there any way to hide and show these two panels in one button click. Please suggest.

like image 602
NDeveloper Avatar asked Jun 27 '13 04:06

NDeveloper


1 Answers

You can use many elements in the update attribute separated by a space

<p:commandButton update="element1 element2"/> 

also you can update the whole form by using update="@form"

like image 186
fareed Avatar answered Oct 23 '22 17:10

fareed