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
2000Redf64ccf95
2000Redf64ccf95
1965Brownc083218c
1990Whited761d4d8
2003Rede9b09548
1986White8b913655
1994Whitec1618839
Total:$38,173.00
BMW
2008Brownd1359632
2008Brownd1359632
1975Red13966a26
1965Red3ef5ca16
1970Yellow70deda65
1985Brown2b68ab3a
1986Bluee729794a
Total:$27,506.00
Fiat
1995Orange25638e69
1995Orange25638e69
1968Silver55c2bd5c
1979Maroon1ba3f145
1986Green73f582ac
2000Maroon30ef4526
Total:$68,353.00
Ford
1967Redecee4cbb
1967Redecee4cbb
1974Red9cd94708
2001Redbff3ea7c
1962Blued47e0af7
Total:$77,953.00
Honda
1995Orange9e01b8e3
1995Orange9e01b8e3
1997Orange1240cdc9
1995Reda899ea04
Total:$64,034.00
Jaguar
2007Maroon46a54ea3
Total:$75,002.00
Mercedes
2005White02a7f438
2005White02a7f438
1978Brown636c2de8
Total:$41,796.00
Renault
2009Yellow74969da3
2009Yellow74969da3
1990Brown989e658d
2007Greena9531327
1963Orange1968bd0e
1965Yellow5f404a69
2008Green40c55a3f
2008Yellow40d9b4f9
Total:$39,178.00
Volkswagen
1991Redcf43f77d
1991Redcf43f77d
1993Bluee4c79326
1995Reddf40dcbd
1972White2c3ef1db
Total:$25,659.00
Volvo
1984Silver5826693b
1984Silver5826693b
1988Brown076e5943
2000Yellow422fc8b2
Total:$5,508.00

Rowspan

BrandYearColorId
Audi2000Redf64ccf95
Audi1965Brownc083218c
Audi1990Whited761d4d8
Audi2003Rede9b09548
Audi1986White8b913655
Audi1994Whitec1618839
Audi2000Yellow0c20b5d9
BMW2008Brownd1359632
BMW1975Red13966a26
BMW1965Red3ef5ca16
BMW1970Yellow70deda65
BMW1985Brown2b68ab3a
BMW1986Bluee729794a
BMW1995Yellowf98ea3c0
Fiat1995Orange25638e69
Fiat1968Silver55c2bd5c
Fiat1979Maroon1ba3f145
Fiat1986Green73f582ac
Fiat2000Maroon30ef4526
Fiat2003Black2ced80dc
Ford1967Redecee4cbb
Ford1974Red9cd94708
Ford2001Redbff3ea7c
Ford1962Blued47e0af7
Ford1976Whitea6b40a5d
Honda1995Orange9e01b8e3
Honda1997Orange1240cdc9
Honda1995Reda899ea04
Honda2003Silver547231e5
Jaguar2007Maroon46a54ea3
Mercedes2005White02a7f438
Mercedes1978Brown636c2de8
Mercedes1972Green749dee36
Renault2009Yellow74969da3
Renault1990Brown989e658d
Renault2007Greena9531327
Renault1963Orange1968bd0e
Renault1965Yellow5f404a69
Renault2008Green40c55a3f
Renault2008Yellow40d9b4f9
Renault1984Blueab4f140d
Volkswagen1991Redcf43f77d
Volkswagen1993Bluee4c79326
Volkswagen1995Reddf40dcbd
Volkswagen1972White2c3ef1db
Volkswagen1998Silver9e7ae802
Volvo1984Silver5826693b
Volvo1988Brown076e5943
Volvo2000Yellow422fc8b2
Volvo1979Yellow819f1081
<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 © 2015
All rights reserved.
Running PrimeFaces-6.0.12 on Mojarra-2.2.8.