This question is about p:dataTable header manipulation.
I want to find a way to manipulate the header p:dataTable (primefaces) from java code directly, to make something like this:
<p:dataTable id="genericReport" value="#{mb.lazyData}" >
<!-- header -->
<p:columnGroup type="header" binding="#{mb.header}" >
</p:columnGroup>
<!-- some data -->
<p:column>
<h:outputText value="..." />
</p:column>
</p:dataTable>
Where #{mb.header}" is a java code read from a XML, manipulated by a tree through XPath.
I want to do this because I have a lot of reports with a complex header; I mean, diferents levels, diferents conbination of cells.
UPDATE
The header could be with a lot of rows, not only one. Here is an example of a a table.
This header has to be generated by an xml configuration. Here is the XML.
<header id="report">
<column text="Granpa Pather">
<column text="Pather 1">
<column text="Child 1">
<column text="Grand Child 1" />
<column text="Grand Child 2" />
</column>
<column text="Child 2" />
<column text="Child 3" />
</column>
<column text="Pather 2">
<column text="Child 4" />
<column text="Child 5" />
</column>
<column text="Pather 3">
<column text="Child 6" />
<column text="Child 7" />
<column text="Child 8" />
</column>
</column>
</encabezado
The colspan and rowspan is calculated by tree theory, it is not the problem.
I achievement to do this in a PDF y XLS (Itext and ApachePOI, respectly), using XPath and tree manipulation. My problem here is that HTML it is not so easy to manipulate. I think it could be to make using the API Primefaces.