DataTable - SubTable SubTable is a helper component for grouping.
NBA Teams
TeamStats
WinsLosses
Los Angeles Lakers
2005-20065032
2006-20074438
2007-20084042
2008-20094537
2009-20104834
2010-20114242
Totals: 269225
Boston Celtics
2005-20064636
2006-20075032
2007-20084141
2008-20094537
2009-20103844
2010-20113547
Totals: 255237
<h:form>
    <p:dataTable var="team" value="#{dtSubTableView.teams}">
        <f:facet name="header">
            NBA Teams
        </f:facet>

        <p:columnGroup type="header">
            <p:row>
                <p:column rowspan="2" headerText="Team" />
                <p:column colspan="2" headerText="Stats" />
            </p:row>
            <p:row>
                <p:column headerText="Wins" />
                <p:column headerText="Losses" />
            </p:row>
        </p:columnGroup>

        <p:subTable var="stats" value="#{team.stats}">
            <f:facet name="header">
                <h:outputText value="#{team.name}" />
            </f:facet>
            <p:column>
                <h:outputText value="#{stats.season}" />
            </p:column>
            <p:column>
                <h:outputText value="#{stats.win}" />
            </p:column>
            <p:column>
                <h:outputText value="#{stats.loss}" />
            </p:column>
            <p:columnGroup type="footer">
                <p:row>
                    <p:column footerText="Totals: " style="text-align:right"/>
                    <p:column footerText="#{team.allWins}" />
                    <p:column footerText="#{team.allLosses}" />
                </p:row>
            </p:columnGroup>
        </p:subTable>
    </p:dataTable>
</h:form>
                
PrimeTek, Copyright © 2017
All rights reserved.
Running PrimeFaces-6.1.4 on Mojarra-2.2.10.