DataTable - Row Grouping - since v6.0.11 Rows can be grouped in two ways, using rowGroup component or with groupRow attribute on a column.

Header Row

YearColorId
Audi
1977Redf38b7b46
2002Reded703c82
1983White43b2fcc6
1978Maroon0d6b4374
Total:$96,215.00
BMW
1995Brown3cd2c238
2002Green951d7241
2007Green5bc1262f
1974Black8bed4c64
1982White55475f54
2002Orange14247d59
1993Orange052bf92e
Total:$83,948.00
Fiat
1974Whitee33a4640
1997Maroon65cb457c
1981Black14980550
Total:$5,398.00
Ford
1985Greene4ff4491
1983Orangec9a807ee
1985Yellowf01562cb
1961Bluea8c56b1f
1960Brown08127b69
2005White086735c0
1963Yellow14d27ad7
1999Orange3f1470c9
Total:$2,430.00
Honda
1986Orangede6d9f45
1984Maroon83fab2c3
1978Maroon37aadd07
1982Orange64ae280e
Total:$42,832.00
Jaguar
2002Reddcb7ca1e
1981Maroon9410aff4
1993Maroona8140627
1995White645f86d2
1961Greende44ba5f
1981Black4efe321f
1968Whiteff64c29d
Total:$3,172.00
Mercedes
1987Black9c902607
2009Brown125c71b9
1969Blue8e2726b0
1995Green2a0a19d0
2008Brown6cdbd2dc
1989Silver96e44026
2002Green6fe887f6
Total:$89,619.00
Renault
1992Silver66718253
1994Blackb3be80af
1990Maroon02d90364
2005Brown7787762a
Total:$93,605.00
Volkswagen
1961Yellow6e786096
1999Black3308f3f8
Total:$49,565.00
Volvo
1985Silver39fe626c
1981Maroon6e10053b
1964Red80a93972
1992Brown1206ed3a
Total:$75,205.00

Rowspan

BrandYearColorId
Audi1977Redf38b7b46
Audi2002Reded703c82
Audi1983White43b2fcc6
Audi1978Maroon0d6b4374
BMW1995Brown3cd2c238
BMW2002Green951d7241
BMW2007Green5bc1262f
BMW1974Black8bed4c64
BMW1982White55475f54
BMW2002Orange14247d59
BMW1993Orange052bf92e
Fiat1974Whitee33a4640
Fiat1997Maroon65cb457c
Fiat1981Black14980550
Ford1985Greene4ff4491
Ford1983Orangec9a807ee
Ford1985Yellowf01562cb
Ford1961Bluea8c56b1f
Ford1960Brown08127b69
Ford2005White086735c0
Ford1963Yellow14d27ad7
Ford1999Orange3f1470c9
Honda1986Orangede6d9f45
Honda1984Maroon83fab2c3
Honda1978Maroon37aadd07
Honda1982Orange64ae280e
Jaguar2002Reddcb7ca1e
Jaguar1981Maroon9410aff4
Jaguar1993Maroona8140627
Jaguar1995White645f86d2
Jaguar1961Greende44ba5f
Jaguar1981Black4efe321f
Jaguar1968Whiteff64c29d
Mercedes1987Black9c902607
Mercedes2009Brown125c71b9
Mercedes1969Blue8e2726b0
Mercedes1995Green2a0a19d0
Mercedes2008Brown6cdbd2dc
Mercedes1989Silver96e44026
Mercedes2002Green6fe887f6
Renault1992Silver66718253
Renault1994Blackb3be80af
Renault1990Maroon02d90364
Renault2005Brown7787762a
Volkswagen1961Yellow6e786096
Volkswagen1999Black3308f3f8
Volvo1985Silver39fe626c
Volvo1981Maroon6e10053b
Volvo1964Red80a93972
Volvo1992Brown1206ed3a
<h3 class="first">Header Row</h3>
<h:form>
    <p:dataTable var="car" value="#{dtRowGroupView.cars}" sortBy="#{car.brand}" expandableRowGroups="true">
        <p:headerRow>
            <p:column colspan="3">
                <h:outputText value="#{car.brand}" />
            </p:column>
        </p:headerRow>
        <p:column headerText="Year">
            <h:outputText value="#{car.year}" />
        </p:column>
        <p:column headerText="Color">
            <h:outputText value="#{car.color}" />
        </p:column>
        <p:column headerText="Id">
            <h:outputText value="#{car.id}" />
        </p:column>
        <p:summaryRow>
            <p:column colspan="2" style="text-align:right">
                <h:outputText value="Total:" />
            </p:column>
            <p:column>
                <h:outputText value="#{dtRowGroupView.randomPrice}">
                    <f:convertNumber type="currency" currencySymbol="$" />
                </h:outputText>
            </p:column>
        </p:summaryRow>
    </p:dataTable>
</h:form>

<h3>Rowspan</h3>
<h:form>
    <p:dataTable var="car" value="#{dtRowGroupView.cars}" sortBy="#{car.brand}">
        <p:column headerText="Brand" groupRow="true">
            <h:outputText value="#{car.brand}" />
        </p:column>
        <p:column headerText="Year">
            <h:outputText value="#{car.year}" />
        </p:column>
        <p:column headerText="Color">
            <h:outputText value="#{car.color}" />
        </p:column>
        <p:column headerText="Id">
            <h:outputText value="#{car.id}" />
        </p:column>
    </p:dataTable>
</h:form>
                
PrimeTek, Copyright © 2017
All rights reserved.
Running PrimeFaces-6.1.4 on Mojarra-2.2.10.