在我使用frozencolumn之前,当我使用frozenColumns和columngrouping时,prime faces Datatable已经丢失了表结构,它渲染得很好,但是当使用frozen column时,它会重复标题
// @tiny 代码更新
<p:dataTable var="dfr" value="#{commisionBean.dfrList}" scrollable="true" scrollWidth="100%" frozenColumns="2" >
<p:columnGroup type="header" >
<p:row>
<p:column colspan="3" headerText="" style="width:30%" />
<p:column colspan="2" headerText="2034 FF 1.5L" />
<p:column colspan="2" headerText="1035 Lab.FF 1.5L" />
<p:column colspan="2" headerText="3083 FF170g" />
<p:column colspan="2" headerText="1032 FF 200ml" />
<p:column colspan="2" headerText="1006 FF 1L Plastic" />
<p:column colspan="2" headerText="0290 Chocolate 75G" />
<p:column colspan="2" headerText="6014 Cream" />
<p:column colspan="2" headerText="0607 Vit_180 M" />
<p:column colspan="2" headerText="0602 Peach_180ml" />
<p:column colspan="2" headerText="3086 LF 170g" />
<p:column colspan="2" headerText="2021 FF 1L" />
<p:column colspan="2" headerText="0603 180M" />
<p:column colspan="2" headerText="0381 - 0 Gr" />
<p:column colspan="2" headerText="1020 Lab.FF 375" />
<p:column colspan="2" headerText="1028 Lab.FF 2L" />
<p:column colspan="2" headerText="2016 FF 200ml" />
</p:row>
<p:row>
<p:column headerText="ID" />
<p:column headerText="CUST" />
<p:column headerText="CLASS" />
<p:column headerText="LSD" />
<p:column headerText="QTY" />
//repeting this for 15 times for sub column
</p:row>
</p:columnGroup>
<p:column style="text-align: left" >
<h:outputText value="#{dfr.customerCodeA }" />
</p:column>
<p:column style="text-align: left">
<h:outputText value="#{dfr.outLetName}" />
</p:column>
<p:column style="text-align: center" >
<h:outputText value="#{dfr.classDesc}" />
</p:column>
<p:column style="text-align: center">
<h:outputText value="#{dfr.day_2034}" rendered="#{(dfr.min_2034 ne null ) and ( dfr.day_2034 ge dfr.min_2034 )}" />
</p:column>
//remaining corresponding column data definition
</p:dataTable>
我尝试了另一种方式,但渲染不正确,两种情况的标题都显示了两次
<p:columnGroup type="header">
<p:row>
<p:column rowspan="2" headerText="Customer ID" />
<p:column rowspan="2" headerText="Customer" />
<p:column rowspan="2" headerText="CLASS" />