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
1967Blued297ca0f
1983Browne23c493f
1989Whitef11836fb
1964Red12a01111
2004Red30f274c1
Total:$19,764.00
BMW
1977Blackfe1ddb7e
1982Yellow2e73d302
1963Silver47deb32c
1971Red215a52e2
1982Maroon85a4eafe
Total:$8,072.00
Fiat
1962Red56c46c30
1970Yellow9a00a5e4
1963Black62c0febf
1992Brown34bf98dd
1995White00dbc80f
Total:$52,083.00
Ford
1974Brown1933c118
1969Silver5003360b
2004Red5384124a
1996Brown6f6e08a2
1983Greenf994f4c5
Total:$2,815.00
Honda
1983Black13d811f8
2004Black9e2ae946
2007Maroonf44967fd
2007Whitee0d0f2d4
1980Maroon8813d175
Total:$44,122.00
Jaguar
2006Redd52ef6dc
2005Yellowbe4f8ea8
1987Orange23abadca
1960Maroond928af8b
1999Yellowf4781472
1970Orangecd5ea5af
1972Maroon4cde87d9
Total:$42,249.00
Mercedes
2004Green45bc68f8
1990Red500e0c9f
1966Black130615ec
Total:$90,043.00
Renault
1969Silverc20c9c62
1994Green31aa9a17
2002Whiteff06bf22
1973Green1d28fe04
2000Brownab61612c
Total:$5,412.00
Volkswagen
1980Blueba24d780
1980Green3d5fc8a6
2007Whitee82d7e20
1968Yellow350a7b0b
1995Green73621271
1985Silver36f80d3e
1981Silver6fb3949b
2000Yellowf6ac5a3e
Total:$56,803.00
Volvo
2006Red5e564354
1998Green5357e1ae
Total:$2,123.00

Rowspan

BrandYearColorId
Audi1967Blued297ca0f
Audi1983Browne23c493f
Audi1989Whitef11836fb
Audi1964Red12a01111
Audi2004Red30f274c1
BMW1977Blackfe1ddb7e
BMW1982Yellow2e73d302
BMW1963Silver47deb32c
BMW1971Red215a52e2
BMW1982Maroon85a4eafe
Fiat1962Red56c46c30
Fiat1970Yellow9a00a5e4
Fiat1963Black62c0febf
Fiat1992Brown34bf98dd
Fiat1995White00dbc80f
Ford1974Brown1933c118
Ford1969Silver5003360b
Ford2004Red5384124a
Ford1996Brown6f6e08a2
Ford1983Greenf994f4c5
Honda1983Black13d811f8
Honda2004Black9e2ae946
Honda2007Maroonf44967fd
Honda2007Whitee0d0f2d4
Honda1980Maroon8813d175
Jaguar2006Redd52ef6dc
Jaguar2005Yellowbe4f8ea8
Jaguar1987Orange23abadca
Jaguar1960Maroond928af8b
Jaguar1999Yellowf4781472
Jaguar1970Orangecd5ea5af
Jaguar1972Maroon4cde87d9
Mercedes2004Green45bc68f8
Mercedes1990Red500e0c9f
Mercedes1966Black130615ec
Renault1969Silverc20c9c62
Renault1994Green31aa9a17
Renault2002Whiteff06bf22
Renault1973Green1d28fe04
Renault2000Brownab61612c
Volkswagen1980Blueba24d780
Volkswagen1980Green3d5fc8a6
Volkswagen2007Whitee82d7e20
Volkswagen1968Yellow350a7b0b
Volkswagen1995Green73621271
Volkswagen1985Silver36f80d3e
Volkswagen1981Silver6fb3949b
Volkswagen2000Yellowf6ac5a3e
Volvo2006Red5e564354
Volvo1998Green5357e1ae
<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.2.RC1 on Mojarra-2.3.2.