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
1967Blackc742b005
1973Brown7b304273
1992Yellow0c9f7ce8
2009Black40478772
2007Browne94bcbfb
1969Reddd256441
2008White43783b0a
1993Maroonc6b7911f
Total:$83,622.00
BMW
1992Brown85de1dac
1973Red5cbee870
1974Orange916a22ca
1969Orange5a1b0f2c
1986Silver83c70a9b
2007Silverd83c21a1
Total:$1,936.00
Fiat
1967Browndd8a9a6b
2001Red3833920d
1990Yellowc1055fb5
1975Blue378cf4c9
1987Yellow26fdb842
Total:$3,808.00
Ford
1986Black38957acc
Total:$55,436.00
Honda
1982Black944c4658
1963Red703b48e6
1996Maroon4fc6a9bd
1973Blue94907e94
1996Silver7a32001a
1994Redfe88a52f
Total:$68,307.00
Jaguar
1967Whited877d2b8
1963Silver17365ba5
1963Brown4a10c090
1986Redd20134c6
1992Red382983a7
1968Blackf0adc83f
Total:$41,596.00
Mercedes
1996White48a580c7
1961Greenf67f50ce
1975Redb8213ccf
1966Redd1226e2a
Total:$12,502.00
Renault
1971Red740ac8b7
1978Browne8174892
1964Black983a62c3
1982Red6f213c26
1966Yellowc96d9d43
Total:$32,809.00
Volkswagen
1983Redef1bf0f1
1977Silverf446bd41
1983Blackd27830ac
1986White3701d75f
1983Orangebad6f69b
Total:$54,231.00
Volvo
1964Reda87c039c
1976Orange74a35900
1971Silver35b13458
1987Red5fb06099
Total:$24,814.00

Rowspan

BrandYearColorId
Audi1967Blackc742b005
Audi1973Brown7b304273
Audi1992Yellow0c9f7ce8
Audi2009Black40478772
Audi2007Browne94bcbfb
Audi1969Reddd256441
Audi2008White43783b0a
Audi1993Maroonc6b7911f
BMW1992Brown85de1dac
BMW1973Red5cbee870
BMW1974Orange916a22ca
BMW1969Orange5a1b0f2c
BMW1986Silver83c70a9b
BMW2007Silverd83c21a1
Fiat1967Browndd8a9a6b
Fiat2001Red3833920d
Fiat1990Yellowc1055fb5
Fiat1975Blue378cf4c9
Fiat1987Yellow26fdb842
Ford1986Black38957acc
Honda1982Black944c4658
Honda1963Red703b48e6
Honda1996Maroon4fc6a9bd
Honda1973Blue94907e94
Honda1996Silver7a32001a
Honda1994Redfe88a52f
Jaguar1967Whited877d2b8
Jaguar1963Silver17365ba5
Jaguar1963Brown4a10c090
Jaguar1986Redd20134c6
Jaguar1992Red382983a7
Jaguar1968Blackf0adc83f
Mercedes1996White48a580c7
Mercedes1961Greenf67f50ce
Mercedes1975Redb8213ccf
Mercedes1966Redd1226e2a
Renault1971Red740ac8b7
Renault1978Browne8174892
Renault1964Black983a62c3
Renault1982Red6f213c26
Renault1966Yellowc96d9d43
Volkswagen1983Redef1bf0f1
Volkswagen1977Silverf446bd41
Volkswagen1983Blackd27830ac
Volkswagen1986White3701d75f
Volkswagen1983Orangebad6f69b
Volvo1964Reda87c039c
Volvo1976Orange74a35900
Volvo1971Silver35b13458
Volvo1987Red5fb06099
<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-SNAPSHOT on Mojarra-2.3.2.