1

Commandbutton with id("myButtonId2") works fine. I mean it updates "myOutputPanel" but commandbutton which is inside datatable doesn't update outputPanel. Is there a specific update style for datatables?

<h:form id="myForm" prependId="false">
  <p:panel id="myPanel">
     <p:dataTable id="myDatatable">
        <p:column style="width:4%">  
          <p:commandButton id="myButtonId" update="myOutputPanel"/>
        </p:column>
     </p:dataTable>
     <p:commandButton id="myButtonId2" update="myOutputPanel"/>
    </p:panel>

 <p:outputPanel id="myOutputPanel">
  //some stuff
 </p:outputPanel>
Turgut Dsfadfa
  • 745
  • 6
  • 18
  • 40

1 Answers1

1

This is because with process and update they work much the same way as the f:ajax component attributes execute and render do. One can only reference the id of a component directly if they reside within the same NamingContainer.

The clientID is generated by prefixing the naming container ids seperated by : by default. The p:panel component does not implement NamingContainer although h:form and p:dataTable do implement NamingContainer.

The clientID of myOutputPanel is as follows:

myForm:myOutputPanel

The second button works because it is outside of the dataTable and relative to myOutputPanel in the same NamingContainer which is the form. To reference the absolute clientID in process or update one can prefix the clientID with the : symbol.

Try changing the update attribute of the first commandButton to:

:myForm:myOutputPanel

This should allow it absolutely reference its generated clientID and work.

maple_shaft
  • 10,389
  • 6
  • 44
  • 70