问题
I am using slightly modified Dynamic Columns from PrimeFaces Showcase: Dynamic columns. Now my task is to add column header grouping as here PrimeFaces Showcase: Group. I am trying to start incrementaly, but even this small code doesn't work (no header are shown):
<p:dataTable id="resultTable" var="result" value="#{myBean.searchResults}">
<p:columnGroup type="header">
<p:row>
<ui:repeat value="#{myBean.columns}" var="column" >
<p:column headerText="#{column.header}" />
</ui:repeat>
</p:row>
</p:columnGroup>
<p:columns value="#{myBean.columns}" var="column" columnIndexVar="colIndex">
<h:outputText value="#{result[column.property]}"/>
</p:columns>
</p:dataTable>
PrimeFaces version 3.4.1
回答1:
Grouping dynamic columns is at least supported in a newer PF version. But only all columns under the same group. But there must be additional code. Check the showcase link you point to
(Ps, will remove this answer later on, since I interpreted the question wrong
来源:https://stackoverflow.com/questions/31589079/how-to-group-headers-of-primefaces-datatable-with-dynamic-columns