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
2002Blue851528ac
1970Bluee83dc024
2000Brown9d6a529d
1970Redbc436fb3
Total:$26,910.00
BMW
1968Maroon435e8fbf
1963Silver86e53d74
1993Yellow9af44848
1967Brown997f8d04
Total:$32,925.00
Fiat
1974Silver6165af77
1975Yellow296cd48b
1965Brown21407ade
2006Redb68ac3b0
Total:$37,619.00
Ford
1998Yellow2589afad
1973Silverca44f990
1982Yellow54118564
1993Green828d14cd
1976Greena8063c40
1985Brownbf05da54
Total:$52,640.00
Honda
2002Maroonc82b81e6
1995Yellow11d0f557
1989Bluec307b990
1988Blue7b3fe7bf
1978Whitee244d161
Total:$94,304.00
Jaguar
2002Orangecf241eab
1973Blue703c91b9
1977Maroond044dd90
Total:$81,281.00
Mercedes
1962Yellow830e840e
1965Silver40d4dc29
1974Brown633f84a7
1987Silvera9fb5d52
2000Orangeb1bea0b8
1971Orange50b3132b
1975Silverc9aff0bc
2007Brown4fdc135b
2002Maroon218888a2
Total:$50,370.00
Renault
2002Blue15044823
2004Brown8e471583
1991Yellow56256a07
1961Silver1003182f
1987Silver9085ada7
Total:$70,766.00
Volkswagen
2005Redca24bc35
1960Green92569f55
2000Green358fb8aa
Total:$70,840.00
Volvo
1986Maroon582c7fd5
1996Green0a14cd95
1965Brown5a0db3b8
1984Blue5f88f61b
1985Whiteda12c1df
1972White2c086d4d
1987Silver059cdb68
Total:$61,200.00

Rowspan

BrandYearColorId
Audi2002Blue851528ac
Audi1970Bluee83dc024
Audi2000Brown9d6a529d
Audi1970Redbc436fb3
BMW1968Maroon435e8fbf
BMW1963Silver86e53d74
BMW1993Yellow9af44848
BMW1967Brown997f8d04
Fiat1974Silver6165af77
Fiat1975Yellow296cd48b
Fiat1965Brown21407ade
Fiat2006Redb68ac3b0
Ford1998Yellow2589afad
Ford1973Silverca44f990
Ford1982Yellow54118564
Ford1993Green828d14cd
Ford1976Greena8063c40
Ford1985Brownbf05da54
Honda2002Maroonc82b81e6
Honda1995Yellow11d0f557
Honda1989Bluec307b990
Honda1988Blue7b3fe7bf
Honda1978Whitee244d161
Jaguar2002Orangecf241eab
Jaguar1973Blue703c91b9
Jaguar1977Maroond044dd90
Mercedes1962Yellow830e840e
Mercedes1965Silver40d4dc29
Mercedes1974Brown633f84a7
Mercedes1987Silvera9fb5d52
Mercedes2000Orangeb1bea0b8
Mercedes1971Orange50b3132b
Mercedes1975Silverc9aff0bc
Mercedes2007Brown4fdc135b
Mercedes2002Maroon218888a2
Renault2002Blue15044823
Renault2004Brown8e471583
Renault1991Yellow56256a07
Renault1961Silver1003182f
Renault1987Silver9085ada7
Volkswagen2005Redca24bc35
Volkswagen1960Green92569f55
Volkswagen2000Green358fb8aa
Volvo1986Maroon582c7fd5
Volvo1996Green0a14cd95
Volvo1965Brown5a0db3b8
Volvo1984Blue5f88f61b
Volvo1985Whiteda12c1df
Volvo1972White2c086d4d
Volvo1987Silver059cdb68
<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.1-SNAPSHOT on Mojarra-2.2.8.