PrimeFaces ColumnGrouping not working with frozenColumns

4.4k Views Asked by At

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

// @tiny code updated

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

There are 1 best solutions below

0
On

Just to make this question answered.

First look at 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.

It works since version 5.1.10 (since 5.2 community edition)