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
1995White4c3be17e
1998Green0c46e961
1972Oranged0d28990
1972Yellow103a55a4
1992Bluec0475567
1987Orange1e722390
Total:$16,924.00
BMW
1984Orange23f95761
1990Yellow55f0de46
1973Green7fcb9a70
1962Greenb2f4be41
1972Greenfc5643f6
1974Greend0b81269
Total:$51,754.00
Fiat
1974Maroon3807e8f9
1962Maroon5a3854be
1986Silver951b212b
1984Yellowe851c9f8
1964Yellow8fb646e5
1993Yellow1bbe96d3
1992Whitef0280878
1962Silverc1fc4c55
1981Oranged6bb4f0e
2002Whitef49f7297
Total:$19,567.00
Ford
1961Maroon931bdb06
1999Blue78b48829
2009Orange6c89a318
1962Silver59168b43
Total:$57,555.00
Honda
1978Bluebd8c7656
1988Yellow9ce8e03a
1965Whitec719db6d
1972Red3b38da38
Total:$98,969.00
Jaguar
1985Orangefe5b228b
1997Brownc447252e
1984Blackb1060a2e
1997Whitee00fa0f3
Total:$51,387.00
Mercedes
1981Brownaa288833
2003Blacke4fcaabd
1986Black36b71143
1994White7f2ba7a0
1962Yellowf7f46acd
1981Silverca8ea595
Total:$24,863.00
Renault
2004Green49b4607d
1992Red23c81b8f
1986Blackcf873b9d
1964Redc936930a
Total:$44,225.00
Volkswagen
2007Browne629d4fa
1988Maroond462977d
Total:$28,332.00
Volvo
1986Brown00a53a62
1980Maroon551c5016
1973Brown5696bd7c
1992Brownc5844093
Total:$70,525.00

Rowspan

BrandYearColorId
Audi1995White4c3be17e
Audi1998Green0c46e961
Audi1972Oranged0d28990
Audi1972Yellow103a55a4
Audi1992Bluec0475567
Audi1987Orange1e722390
BMW1984Orange23f95761
BMW1990Yellow55f0de46
BMW1973Green7fcb9a70
BMW1962Greenb2f4be41
BMW1972Greenfc5643f6
BMW1974Greend0b81269
Fiat1974Maroon3807e8f9
Fiat1962Maroon5a3854be
Fiat1986Silver951b212b
Fiat1984Yellowe851c9f8
Fiat1964Yellow8fb646e5
Fiat1993Yellow1bbe96d3
Fiat1992Whitef0280878
Fiat1962Silverc1fc4c55
Fiat1981Oranged6bb4f0e
Fiat2002Whitef49f7297
Ford1961Maroon931bdb06
Ford1999Blue78b48829
Ford2009Orange6c89a318
Ford1962Silver59168b43
Honda1978Bluebd8c7656
Honda1988Yellow9ce8e03a
Honda1965Whitec719db6d
Honda1972Red3b38da38
Jaguar1985Orangefe5b228b
Jaguar1997Brownc447252e
Jaguar1984Blackb1060a2e
Jaguar1997Whitee00fa0f3
Mercedes1981Brownaa288833
Mercedes2003Blacke4fcaabd
Mercedes1986Black36b71143
Mercedes1994White7f2ba7a0
Mercedes1962Yellowf7f46acd
Mercedes1981Silverca8ea595
Renault2004Green49b4607d
Renault1992Red23c81b8f
Renault1986Blackcf873b9d
Renault1964Redc936930a
Volkswagen2007Browne629d4fa
Volkswagen1988Maroond462977d
Volvo1986Brown00a53a62
Volvo1980Maroon551c5016
Volvo1973Brown5696bd7c
Volvo1992Brownc5844093
<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>