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
1996Yellow1c5ae8aa
1979Brown8b415dfe
1981Orangea895bc9f
1961Blackedb0d99e
2009Orange1f18d21a
1999White288b4252
1977Yellow499d8a59
1969Green743c1451
Total:$91,702.00
BMW
1996Blueca1f004d
1994Green49db7450
1960Browna1c4afe1
1988Whitec35fe266
1998Silveref18c039
1989Silver3461454b
1978Green9e5a8d6d
Total:$43,657.00
Fiat
1987Black646d5fa0
Total:$79,722.00
Ford
1981Green1b1a2dff
1972Silver076ac397
2008White31fb3b9b
1968Yellow3c18df29
2000Orange312c01b0
Total:$30,352.00
Honda
1963Yellow75663591
2003Brown06a2a7f8
Total:$20,586.00
Jaguar
1989Reded06e7e2
1980Greenaf1af219
2004White5c774581
1977Blue316afc7b
1985Blueb829faea
Total:$236.00
Mercedes
2009Yellow67cceeb4
2005Yellow2f7132c1
1979Orangee3ceefb8
1987Red9b9da45d
2001Red4b74e2bf
1963Blue37e6a356
1984Whitebffd04a0
1974Maroon7dc0ac43
Total:$99,521.00
Renault
1963Red3c146afa
1999Maroon33c70c51
1969Silver1d6abeb6
Total:$4,742.00
Volkswagen
1968Maroon4d6fe13e
1974Black704355b0
1981Yellow4b1df634
1996Red95149286
Total:$71,851.00
Volvo
1993Yellow2672f046
1990Silver7ca88c35
1981Maroon58c340e4
1964Yellow5e48ae85
1971Blackaf804978
1983White084f1e0b
1996Yellowbf5405bf
Total:$83,387.00

Rowspan

BrandYearColorId
Audi1996Yellow1c5ae8aa
Audi1979Brown8b415dfe
Audi1981Orangea895bc9f
Audi1961Blackedb0d99e
Audi2009Orange1f18d21a
Audi1999White288b4252
Audi1977Yellow499d8a59
Audi1969Green743c1451
BMW1996Blueca1f004d
BMW1994Green49db7450
BMW1960Browna1c4afe1
BMW1988Whitec35fe266
BMW1998Silveref18c039
BMW1989Silver3461454b
BMW1978Green9e5a8d6d
Fiat1987Black646d5fa0
Ford1981Green1b1a2dff
Ford1972Silver076ac397
Ford2008White31fb3b9b
Ford1968Yellow3c18df29
Ford2000Orange312c01b0
Honda1963Yellow75663591
Honda2003Brown06a2a7f8
Jaguar1989Reded06e7e2
Jaguar1980Greenaf1af219
Jaguar2004White5c774581
Jaguar1977Blue316afc7b
Jaguar1985Blueb829faea
Mercedes2009Yellow67cceeb4
Mercedes2005Yellow2f7132c1
Mercedes1979Orangee3ceefb8
Mercedes1987Red9b9da45d
Mercedes2001Red4b74e2bf
Mercedes1963Blue37e6a356
Mercedes1984Whitebffd04a0
Mercedes1974Maroon7dc0ac43
Renault1963Red3c146afa
Renault1999Maroon33c70c51
Renault1969Silver1d6abeb6
Volkswagen1968Maroon4d6fe13e
Volkswagen1974Black704355b0
Volkswagen1981Yellow4b1df634
Volkswagen1996Red95149286
Volvo1993Yellow2672f046
Volvo1990Silver7ca88c35
Volvo1981Maroon58c340e4
Volvo1964Yellow5e48ae85
Volvo1971Blackaf804978
Volvo1983White084f1e0b
Volvo1996Yellowbf5405bf
<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 © 2015
All rights reserved.
Running PrimeFaces-6.0.16 on Mojarra-2.2.8.