2

I have a <p:dataTable>. I would like to render a <p:column> conditionally as follows:

<p:dataTable value="#{abcList}" var="abc">
  <p:column rendered="#{headerShow}">
    <f:facet name="header">
      <h:outputText value="header" />
    </f:facet>
    <h:outputText value="#{abc.hijk}" />
  </p:column>
</p:dataTable>

When #{headerShow} is false, then the column is hidden. When #{headerShow} is true, then the column is shown, but without header. When I hardcode rendered="true", then the column is shown with header.

How is this caused and how can I solve it?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
funckymilk
  • 21
  • 1
  • 2

1 Answers1

1

<f:facet name="header"> is outdated for column names. Primefaces 3.0 introduced the headerText attribute doing exactly the same.

So try this instead:

<p:column rendered="#{headerShow}" headerText="header">
  <h:outputText value="#{abc.hijk}" />
</p:column>