user3364429
user3364429

Reputation: 1

How to Update outputpanel from commandbutton which is inside the datatable using primefaces

Commandbutton with id("myButtonId2") works fine. I mean it updates "myOutputPanel" 

but commandbutton(myButtonId) which is inside datatable doesn't update outputPanel. I found the suggestions and tried with the following, update=":myForm:myOutputPanel" update="@myForm" update=":myOutputPanel"
But none of them worked...

Here is the snippet...
 <h:form id="myForm" prependId="false">
      <p:panel id="myPanel">
         <p:dataTable id="myDatatable">
            <p:column style="width:4%">  
              <p:commandButton id="myButtonId" actionListener="#{bean.showPanel}" update="myOutputPanel"/>
            </p:column>
         </p:dataTable>
         <p:commandButton id="myButtonId2" update="myOutputPanel"/>
        </p:panel>

     <p:outputPanel id="myOutputPanel" rendered="#{bean.show}">
      //some stuff
     </p:outputPanel>

Upvotes: 0

Views: 9241

Answers (1)

David H.
David H.

Reputation: 963

Try to put your <p:outputPanel /> inside a <p:panel />

and add a "widgetVar" attribute

For example : <p:panel widgetVar="var" [..]>

and just update the panel directly with update="@widgetVar(var)"

Upvotes: 4

Related Questions