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
1998Silvercac605d1
1999Yellowfe719d5b
1964Red452af761
1984Yellowb4a70128
1977Whited3c0497d
2005Brown1d164977
Total:$49,323.00
BMW
1993Blue64f3e2c8
1992Whited31a4d4b
1998Orange3a208ca5
1992Redc17dc055
Total:$11,398.00
Fiat
1974Bluec56291d3
1971White286306e9
2004Brownc7288d85
1995Blue8956ee87
Total:$4,225.00
Ford
1999Orange6fddf64b
2004Silvereabaffcd
1988Yellow66b1489b
1993Blackf1ef0ed9
1972Greena94a2b53
Total:$56,625.00
Honda
2008Blue0416bb15
1969Redf61046c1
1976Silver07576962
1996Orange10016f49
1987Maroonebba4fb7
Total:$81,226.00
Jaguar
1971Blue7737d6d3
1971Blacka112f129
1982Blacka3ba0d68
2003Yellow53451b76
1969Orangec1cf4c81
2006Blackd3600aa9
1981Maroon4531f582
Total:$77,617.00
Mercedes
1986Black69478bcc
1963Silverb69d2e3d
1988Redb5c2e1db
1990Greenfb5fed2c
1968Blackcf073f69
Total:$248.00
Renault
1998Brown6bd368c4
1963Maroon6e0f246d
1971Maroona0517d12
1964Green6a117b8f
1982Green9e01b873
Total:$67,578.00
Volkswagen
1964Yellow90509b73
1973Blackb6881d29
1988Green2f2d68d6
Total:$82,605.00
Volvo
1985Yellow0adfd6a8
2009Orangeeb083836
1975Whiteef9dd884
1969White612f913c
2001Black3c097b42
1972Greenbf6de715
Total:$99,610.00

Rowspan

BrandYearColorId
Audi1998Silvercac605d1
Audi1999Yellowfe719d5b
Audi1964Red452af761
Audi1984Yellowb4a70128
Audi1977Whited3c0497d
Audi2005Brown1d164977
BMW1993Blue64f3e2c8
BMW1992Whited31a4d4b
BMW1998Orange3a208ca5
BMW1992Redc17dc055
Fiat1974Bluec56291d3
Fiat1971White286306e9
Fiat2004Brownc7288d85
Fiat1995Blue8956ee87
Ford1999Orange6fddf64b
Ford2004Silvereabaffcd
Ford1988Yellow66b1489b
Ford1993Blackf1ef0ed9
Ford1972Greena94a2b53
Honda2008Blue0416bb15
Honda1969Redf61046c1
Honda1976Silver07576962
Honda1996Orange10016f49
Honda1987Maroonebba4fb7
Jaguar1971Blue7737d6d3
Jaguar1971Blacka112f129
Jaguar1982Blacka3ba0d68
Jaguar2003Yellow53451b76
Jaguar1969Orangec1cf4c81
Jaguar2006Blackd3600aa9
Jaguar1981Maroon4531f582
Mercedes1986Black69478bcc
Mercedes1963Silverb69d2e3d
Mercedes1988Redb5c2e1db
Mercedes1990Greenfb5fed2c
Mercedes1968Blackcf073f69
Renault1998Brown6bd368c4
Renault1963Maroon6e0f246d
Renault1971Maroona0517d12
Renault1964Green6a117b8f
Renault1982Green9e01b873
Volkswagen1964Yellow90509b73
Volkswagen1973Blackb6881d29
Volkswagen1988Green2f2d68d6
Volvo1985Yellow0adfd6a8
Volvo2009Orangeeb083836
Volvo1975Whiteef9dd884
Volvo1969White612f913c
Volvo2001Black3c097b42
Volvo1972Greenbf6de715
<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.3-SNAPSHOT on Mojarra-2.3.2.