hide primefaces table column header

santa029 picture santa029 · Oct 10, 2012 · Viewed 26.4k times · Source

I have a p:treeTable and the tree contents are all in one column. The tree is a shared component so some of my pages require column header and and some don't. In the pages where the columnHeader is empty, it creates the an empty row for the column header, which I don't want. I do want the column contents, just not the header when there is no column header.

How can I fix this? Any pointers/ideas would be great. Thanks!

Answer

Akos K picture Akos K · Oct 10, 2012

You can solved that with custom CSS by setting the thead display attribute to none:

Example:

div[id="testForm:first"] thead {
    display:none;
}

if your JSF is similar to this:

<h:form id="testForm">
    <p:dataTable id="first">
        ...
    <p:/dataTable>
</h:form>