简体   繁体   English

PrimeFaces ColumnGrouping无法与FrozenColumns一起使用

[英]PrimeFaces ColumnGrouping not working with frozenColumns

prime faces Datatable have lost table structure when using frozenColumns and columngrouping together before I use frozencolumn it renders well, but when using frozen column it's repeating headers 当我在使用frozencolumn之前将frozenColumns和columngrouping一起使用时,素面数据表丢失了表结构,但是当使用frozen列时,它重复了标题

// @tiny code updated // @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>

I tried another way, but not renders correctly, both cases header displaying twice 我尝试了另一种方法,但渲染不正确,两种情况的标头均显示两次

<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" />

Just to make this question answered. 只是为了使这个问题得到解答。

First look at http://forum.primefaces.org/viewtopic.php?f=3&t=40580 首先看一下http://forum.primefaces.org/viewtopic.php?f=3&t=40580

Quote from documentation: 从文档引用:

Datatable Column Grouping Section 数据表列分组部分

For frozen columns, use frozenHeader, frozenFooter, scrollableHeader and scrollableFooter types. 对于冻结列,请使用FrozenHeader,frozenFooter,scrollableHeader和scrollableFooter类型。

It works since version 5.1.10 (since 5.2 community edition) 从5.1.10版本开始有效(从5.2社区版本开始)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM