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
1993Brown3569829c
2000Redadb4e399
1983Blackaab24841
1976Maroon902e9461
1976White83f8c43f
Total:$79,416.00
BMW
1993White8fbcc3d0
1986White2295200d
1977Green319b7419
1985Redf2a2bd29
Total:$69,440.00
Fiat
2003Red93987f6d
1994Greenadb78585
1969Green5bceaf07
Total:$36,177.00
Ford
2003Maroon2b2b2b7f
1968Brown399f7a4f
2002Blue1aacd7f6
1990Marooned9d5409
1978Silver63214ce0
1962Yellowf6d19734
2008Brownea915c5c
1985Brown38eda2e3
Total:$72,356.00
Honda
2002Silver210fc8c2
2005Green0dbe7a14
1999Yellowcd2f2b79
1982Green612a22fb
1986Brown8767a49a
2008Brownde5840e4
Total:$99,071.00
Jaguar
2001Greenf2899cfc
1994White0fd72ab8
1980Silver71286e4f
1967Whitee56e135d
1996Brown495f24d1
Total:$84,938.00
Mercedes
1968Orange8c5605f4
1961Silver470e6c2b
2001Yellow46a098b0
Total:$34,761.00
Renault
1974White2c02ce35
1999Redfd592fd5
Total:$31,604.00
Volkswagen
1994Orange13e5838a
1998Black82428684
1985Whitee0e296cb
1988Blue0aa69760
1961Orange58cf8088
1995Blued065d802
2002Maroon16c43f50
1970Blue5a2d8097
Total:$77,504.00
Volvo
1982Black5dc491dc
1963Browned17187e
1967Yellow9199fbc4
1993Maroonec099161
1999Red7c81683e
1996Yellow9b705f9e
Total:$20,622.00

Rowspan

BrandYearColorId
Audi1993Brown3569829c
Audi2000Redadb4e399
Audi1983Blackaab24841
Audi1976Maroon902e9461
Audi1976White83f8c43f
BMW1993White8fbcc3d0
BMW1986White2295200d
BMW1977Green319b7419
BMW1985Redf2a2bd29
Fiat2003Red93987f6d
Fiat1994Greenadb78585
Fiat1969Green5bceaf07
Ford2003Maroon2b2b2b7f
Ford1968Brown399f7a4f
Ford2002Blue1aacd7f6
Ford1990Marooned9d5409
Ford1978Silver63214ce0
Ford1962Yellowf6d19734
Ford2008Brownea915c5c
Ford1985Brown38eda2e3
Honda2002Silver210fc8c2
Honda2005Green0dbe7a14
Honda1999Yellowcd2f2b79
Honda1982Green612a22fb
Honda1986Brown8767a49a
Honda2008Brownde5840e4
Jaguar2001Greenf2899cfc
Jaguar1994White0fd72ab8
Jaguar1980Silver71286e4f
Jaguar1967Whitee56e135d
Jaguar1996Brown495f24d1
Mercedes1968Orange8c5605f4
Mercedes1961Silver470e6c2b
Mercedes2001Yellow46a098b0
Renault1974White2c02ce35
Renault1999Redfd592fd5
Volkswagen1994Orange13e5838a
Volkswagen1998Black82428684
Volkswagen1985Whitee0e296cb
Volkswagen1988Blue0aa69760
Volkswagen1961Orange58cf8088
Volkswagen1995Blued065d802
Volkswagen2002Maroon16c43f50
Volkswagen1970Blue5a2d8097
Volvo1982Black5dc491dc
Volvo1963Browned17187e
Volvo1967Yellow9199fbc4
Volvo1993Maroonec099161
Volvo1999Red7c81683e
Volvo1996Yellow9b705f9e
<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.3 on Mojarra-2.3.2.