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
1986Brown316f7f03
1995Brown9fc98075
1961Yellow86967583
1973Blackd6ba8baa
Total:$65,455.00
BMW
1981Silver54f04908
1964Silver0bc8e05c
1973Redaa5bc4c6
1971Blue93b40c2f
1973Blue52b43d41
1989Orangeb30a9dd0
1992Whitee42a7401
2003Redc2713a3d
1987Greene2c1d390
Total:$6,124.00
Fiat
2004Brown069f0008
1971Yellow02693624
1960Maroon86da38d7
Total:$89,101.00
Ford
1980Black69f37c94
2005Orange30973cd3
2009Orangea04b7c22
Total:$78,392.00
Honda
1998Red5976194b
1961Green5b738e69
1962White3def33de
Total:$188.00
Jaguar
2000Silver5551dc79
1995Redd01722a3
2000Orange75d10f11
2000Blued9a4aaec
Total:$2,789.00
Mercedes
1992Whitefff0c9db
1976White307e229e
2007Greene9319932
1963Brown953068fc
1974Green4ff23c1f
2009Green41800a5e
Total:$49,441.00
Renault
1997Red4462d0a1
1993White71f310a7
1967Black9b0fab2f
2000Blackb38f91a9
1991Blue97404ba2
1992Greenb5df8abd
Total:$78,723.00
Volkswagen
1988White490518b1
2009Silver334b7bf4
1997Silver33335810
2000Black75be0c28
1975Brownc57e5fc6
1998Maroon85499ad8
Total:$31,564.00
Volvo
2004Orangea387e63d
1995Yellow645116dd
2006Green89c7958d
1991Black71c5f5e9
1975Whiteb9cbd090
1999Silver5189cbca
Total:$69,189.00

Rowspan

BrandYearColorId
Audi1986Brown316f7f03
Audi1995Brown9fc98075
Audi1961Yellow86967583
Audi1973Blackd6ba8baa
BMW1981Silver54f04908
BMW1964Silver0bc8e05c
BMW1973Redaa5bc4c6
BMW1971Blue93b40c2f
BMW1973Blue52b43d41
BMW1989Orangeb30a9dd0
BMW1992Whitee42a7401
BMW2003Redc2713a3d
BMW1987Greene2c1d390
Fiat2004Brown069f0008
Fiat1971Yellow02693624
Fiat1960Maroon86da38d7
Ford1980Black69f37c94
Ford2005Orange30973cd3
Ford2009Orangea04b7c22
Honda1998Red5976194b
Honda1961Green5b738e69
Honda1962White3def33de
Jaguar2000Silver5551dc79
Jaguar1995Redd01722a3
Jaguar2000Orange75d10f11
Jaguar2000Blued9a4aaec
Mercedes1992Whitefff0c9db
Mercedes1976White307e229e
Mercedes2007Greene9319932
Mercedes1963Brown953068fc
Mercedes1974Green4ff23c1f
Mercedes2009Green41800a5e
Renault1997Red4462d0a1
Renault1993White71f310a7
Renault1967Black9b0fab2f
Renault2000Blackb38f91a9
Renault1991Blue97404ba2
Renault1992Greenb5df8abd
Volkswagen1988White490518b1
Volkswagen2009Silver334b7bf4
Volkswagen1997Silver33335810
Volkswagen2000Black75be0c28
Volkswagen1975Brownc57e5fc6
Volkswagen1998Maroon85499ad8
Volvo2004Orangea387e63d
Volvo1995Yellow645116dd
Volvo2006Green89c7958d
Volvo1991Black71c5f5e9
Volvo1975Whiteb9cbd090
Volvo1999Silver5189cbca
<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.