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
1994White021d711d
1972Orange5ee8407e
1988Blue862d5d41
1995Silver51bc271b
1987Greene4fa115c
Total:$73,938.00
BMW
1985Maroon639047e4
2008Blackf21e0088
Total:$27,383.00
Fiat
1972Blackb6019bcb
2005Greenf01936e0
1992Orangebeaae543
Total:$55,858.00
Ford
2004Maroon8bce124b
1999Red1e0ad926
1988White454812ac
1996Brown302abe3d
2004Black7dbdfc52
Total:$79,101.00
Honda
1962Bluee65041f2
2002Red58a1e025
1977Bluee64b9936
2005Oranged04dc3cc
2002Whiteebed272c
2008Browncaf4cd76
1985Black603d6dda
Total:$54,619.00
Jaguar
1988Whitea90c57db
1999Black789aa0e0
1973Yellow1e480293
1966Yellow38cf6fdb
1974Maroon6623ecb3
2009Red46c69276
Total:$84,744.00
Mercedes
2006Silver55027f65
2005Blueabf00984
1990Yellow077e6cb8
1961Rededc7d3ec
1961Maroon7fbafa6f
1982Orangef5821487
1972Maroona37c873d
Total:$13,221.00
Renault
1972Maroon80cbad0b
1975Yellowa0638e92
1978Whitee815e5e3
2006Blue6c5ff30e
Total:$98,740.00
Volkswagen
1981Black59e62e89
1989Whited3895c9e
1987Redef7d5ee7
1977Brown9d49432e
Total:$9,935.00
Volvo
1984Silver24f7b141
1984Brown5371e231
1973Redb0b15043
2001Yellowd4825c83
1969Blue30cea7c0
1977Bluefa5b6d61
1988Maroonae825413
Total:$42,417.00

Rowspan

BrandYearColorId
Audi1994White021d711d
Audi1972Orange5ee8407e
Audi1988Blue862d5d41
Audi1995Silver51bc271b
Audi1987Greene4fa115c
BMW1985Maroon639047e4
BMW2008Blackf21e0088
Fiat1972Blackb6019bcb
Fiat2005Greenf01936e0
Fiat1992Orangebeaae543
Ford2004Maroon8bce124b
Ford1999Red1e0ad926
Ford1988White454812ac
Ford1996Brown302abe3d
Ford2004Black7dbdfc52
Honda1962Bluee65041f2
Honda2002Red58a1e025
Honda1977Bluee64b9936
Honda2005Oranged04dc3cc
Honda2002Whiteebed272c
Honda2008Browncaf4cd76
Honda1985Black603d6dda
Jaguar1988Whitea90c57db
Jaguar1999Black789aa0e0
Jaguar1973Yellow1e480293
Jaguar1966Yellow38cf6fdb
Jaguar1974Maroon6623ecb3
Jaguar2009Red46c69276
Mercedes2006Silver55027f65
Mercedes2005Blueabf00984
Mercedes1990Yellow077e6cb8
Mercedes1961Rededc7d3ec
Mercedes1961Maroon7fbafa6f
Mercedes1982Orangef5821487
Mercedes1972Maroona37c873d
Renault1972Maroon80cbad0b
Renault1975Yellowa0638e92
Renault1978Whitee815e5e3
Renault2006Blue6c5ff30e
Volkswagen1981Black59e62e89
Volkswagen1989Whited3895c9e
Volkswagen1987Redef7d5ee7
Volkswagen1977Brown9d49432e
Volvo1984Silver24f7b141
Volvo1984Brown5371e231
Volvo1973Redb0b15043
Volvo2001Yellowd4825c83
Volvo1969Blue30cea7c0
Volvo1977Bluefa5b6d61
Volvo1988Maroonae825413
<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.