3

I hava a composite component with a PrimeFaces dataTable inside. The column definition should be done outside of this component in a facet definition.

<composite:interface>
  <composite:attribute name="domains" required="true"/>
  <composite:facet name="domainColumns" required="true"/>
</composite:interface>

<composite:implementation>
  <p:dataTable var="var" value="#{cc.attrs.domains}">
    <composite:renderFacet name="domainColumns"/>
  </p:dataTable>
</composite:implementation>

I want to use this component like shown here:

<my:domainTable domains="#{adminTsWorkspaceBean.domains}">
    <f:facet name="domainColumns">
        <p:column headerText="Header">
            <h:outputText value="#{var.id}" />
        </p:column> 
    </f:facet>
</my:domainTable>

Interestingly: If I use the p:column as a child and not as a facet and then in my component <composite:insertChildren/>, I have the desired output. But of course I can insert the children only at one position in my component. I'm trying to define the column for two different dataTables?

Thor
  • 6,607
  • 13
  • 62
  • 96
  • As far as I can see, what you're trying to achieve is to be able to define the columns outside the component. That's done by `insertChildren`. The `facet` is used to define a more static content into the composite and not it's structure. `But of course limited to one child.` What do you mean by that? – Aritz Jan 31 '16 at 11:23
  • It's a simplified example. In fact it's describing a whole page which can be re-used and I have multiple dataTables inside. _Limited to one child_ was imprecise, I'm editing the question. – Thor Jan 31 '16 at 12:55
  • 2
    This problem has same grounds as http://stackoverflow.com/q/11439886 – BalusC Jan 31 '16 at 13:01
  • This is like using facets in a datatable without using a composite. This fails to. It simply is not supported because the way facets should be used. Defining a whole page like this is wrong. Use insert/define etc… I get the impression you are over generalizing things – Kukeltje Jan 31 '16 at 13:01

0 Answers0