如何使用动态列对PrimeFaces dataTable的标题进行分组 [英] How to group headers of PrimeFaces dataTable with dynamic columns
问题描述
我使用 PrimeFaces展示:动态列。现在我的任务是添加列标题分组,如下所示: PrimeFaces Showcase:Group < a>。我试图开始增量,但即使这个小代码也不起作用(没有标题显示):
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版本3.4.1
PrimeFaces version 3.4.1
推荐答案
分组动态列至少在较新的PF版本中得到支持。但只有同一组下的所有列。但是必须有其他代码。检查您指向的展示链接
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,稍后将删除此答案,因为我解释了错误的问题
(Ps, will remove this answer later on, since I interpreted the question wrong
这篇关于如何使用动态列对PrimeFaces dataTable的标题进行分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!