JSF Updating Composite Component

Is it possible to update the children of a composite component simply by specifying the parent composite identifier? For example. if I have:

<composite:interface>
    <composite:attribute name="value" type="..." required="true"/>
</composite:interface>

<composite:implementation>
    <p:treeTable id="main-tree" ...>
        ...
    </p:treeTable>

</composite:implementation>

      

and use it something like this:

<my:comp id="composite-component" />

...

<p:ajax update="composite-component" />

      

Is it possible? Right now, the only way I can see is to explicitly specify the child component id:

<p:ajax update="composite-component:main-tree" />

      

+3


source to share


1 answer


This can be done by wrapping <div>

around the composite components implementation and setting the div id=#{cc.clientId}

:

<html ...>
    <composite:interface>
       ...
    </composite:interface>

    <composite:implementation>
      <div id="#{cc.clientId}">
        ...
      </div>
    </composite:implementation>    
</html>

      

And on the usage page:



<my:comp id="composite-component" />
....
<h:commandButton value="Update first name">
   <f:ajax execute="composite-component" render="composite-component">
</h:commandButton>

      

<p:ajax>

should work appropriately.

+13


source







All Articles