DataTable - RowExpansion A row can be expanded to display detail content using a row expansion column and expansion facet.
Expand rows to see detailed information
IdYear
89c7c43a2005
8c8a399a1962
3b8e2aa81988
95c2b3102002
71541e511995
1a0a5c421971
3fea6d891977
5a46c2401995
1d10d44c1960
f5bb1a071996
<h:form>
    <p:dataTable var="car" value="#{dtBasicView.cars}">
        <f:facet name="header">
            Expand rows to see detailed information
        </f:facet>
        <p:column style="width:16px">
            <p:rowToggler />
        </p:column>
        <p:column headerText="Id">
            <h:outputText value="#{car.id}" />
        </p:column>
        <p:column headerText="Year">
            <h:outputText value="#{car.year}" />
        </p:column>

        <p:rowExpansion>
            <p:panelGrid  columns="2" columnClasses="label,value" style="width:300px">
                <f:facet name="header">
                    <p:graphicImage name="demo/images/car/#{car.brand}-big.gif"/> 
                </f:facet>

                <h:outputText value="Id:" />
                <h:outputText value="#{car.id}" />

                <h:outputText value="Year" />
                <h:outputText value="#{car.year}" />

                <h:outputText value="Color:" />
                <h:outputText value="#{car.color}" style="color:#{car.color}"/>

                <h:outputText value="Price" />
                <h:outputText value="$#{car.price}" />
            </p:panelGrid>
        </p:rowExpansion>
    </p:dataTable>
</h:form>
                
PrimeTek, Copyright © 2015
All rights reserved.
Running PrimeFaces-6.1-SNAPSHOT on Mojarra-2.2.8.