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
1976Blackf0d62647
1995Blackefe59ab3
1979Silver18d2025a
1961Yellow5b4f16e5
2004Blue7281d134
Total:$60,182.00
BMW
1979Silver822d2ddd
1988Brown57cf0029
1995Whiteb38c2567
1985Blueaffac05d
1982Redaf16b6b4
1971Whitef8e364f9
Total:$68,200.00
Fiat
1974Green473fd70c
1966Red5e346693
2007Green2ad27cfe
1999Brown9fce7d2b
1960Brown1ea24a95
1977Silver15b93b82
Total:$72,562.00
Ford
1970Silver35e43f3c
1974Redc89d3c23
1997Green7b298f01
1983Green7d7142c2
Total:$18,596.00
Honda
1976Yellow6b052fd1
1961Blueb805215f
1982White91467b24
1961Yellow2bf5c78d
Total:$27,172.00
Jaguar
1982Redac4f8a0e
2005Blueab7af9a6
1972White34928243
1962Greena3f16a82
Total:$87,057.00
Mercedes
1986White203d6b73
1980Blue040511bc
1992Whiteff4bc45b
1971Red0711934e
1962Silver8fc1be33
1999Yellow5cdcd457
Total:$92,465.00
Renault
2000Brown69f12322
1973Brown38d470f8
1976Green0b4686f2
Total:$31,499.00
Volkswagen
2002Blue558477ac
1997Blue3064b57d
1980Whiteb982217b
1964Blue76ac035b
1979Red7ae71b5f
Total:$81,167.00
Volvo
1997Maroon65e552cc
2002Blacke5ae7f42
1985Browncf4097b3
1985Orange953abb34
2002Black894bb6ef
2004White0560b9b9
1960Blue8f32d4fa
Total:$59,869.00

Rowspan

BrandYearColorId
Audi1976Blackf0d62647
Audi1995Blackefe59ab3
Audi1979Silver18d2025a
Audi1961Yellow5b4f16e5
Audi2004Blue7281d134
BMW1979Silver822d2ddd
BMW1988Brown57cf0029
BMW1995Whiteb38c2567
BMW1985Blueaffac05d
BMW1982Redaf16b6b4
BMW1971Whitef8e364f9
Fiat1974Green473fd70c
Fiat1966Red5e346693
Fiat2007Green2ad27cfe
Fiat1999Brown9fce7d2b
Fiat1960Brown1ea24a95
Fiat1977Silver15b93b82
Ford1970Silver35e43f3c
Ford1974Redc89d3c23
Ford1997Green7b298f01
Ford1983Green7d7142c2
Honda1976Yellow6b052fd1
Honda1961Blueb805215f
Honda1982White91467b24
Honda1961Yellow2bf5c78d
Jaguar1982Redac4f8a0e
Jaguar2005Blueab7af9a6
Jaguar1972White34928243
Jaguar1962Greena3f16a82
Mercedes1986White203d6b73
Mercedes1980Blue040511bc
Mercedes1992Whiteff4bc45b
Mercedes1971Red0711934e
Mercedes1962Silver8fc1be33
Mercedes1999Yellow5cdcd457
Renault2000Brown69f12322
Renault1973Brown38d470f8
Renault1976Green0b4686f2
Volkswagen2002Blue558477ac
Volkswagen1997Blue3064b57d
Volkswagen1980Whiteb982217b
Volkswagen1964Blue76ac035b
Volkswagen1979Red7ae71b5f
Volvo1997Maroon65e552cc
Volvo2002Blacke5ae7f42
Volvo1985Browncf4097b3
Volvo1985Orange953abb34
Volvo2002Black894bb6ef
Volvo2004White0560b9b9
Volvo1960Blue8f32d4fa
<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>