DataTable - ColumnToggler

ColumnToggler is a helper component of datatable to toggle the visibility of columns.

Documentation
List of Cars
IdYearBrandColorPrice
0759a4992003RenaultBlue$89,635.00
688ff5e71979MercedesRed$11,731.00
006eda2d2004HondaOrange$35,839.00
91f27d1c1980AudiMaroon$34,541.00
fed696441965HondaRed$43,147.00
db449d8b1993VolvoYellow$66,743.00
52a8f55f1972BMWWhite$27,291.00
4288e2d42004HondaSilver$96,694.00
c94286071981JaguarBrown$73,725.00
d72293371978BMWMaroon$32,603.00
<style type="text/css">
    .ui-datatable-header {
        height: 50px
    }
</style>


<p:dataTable id="cars" var="car" value="#{dtBasicView.cars}">
    <f:facet name="header">
        List of Cars

        <p:commandButton id="toggler" type="button" value="Columns" style="float:right" icon="pi pi-align-justify" />
        <p:columnToggler datasource="cars" trigger="toggler" />
    </f:facet>
    
    <p:column headerText="Id">
        <h:outputText value="#{car.id}" />
    </p:column>

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

    <p:column headerText="Brand">
        <h:outputText value="#{car.brand}" />
    </p:column>

    <p:column headerText="Color">
        <h:outputText value="#{car.color}" />
    </p:column>
    
    <p:column headerText="Price">
        <h:outputText value="#{car.price}">
            <f:convertNumber type="currency" currencySymbol="$" />
        </h:outputText>
    </p:column>
</p:dataTable>

FREE THEMES

Built-in component themes created by the PrimeFaces Theme Designer.

nova-light Nova-Light
nova-dark Nova-Dark
nova-colored Nova-Colored
luna-blue Luna-Blue
luna-amber Luna-Amber
luna-green Luna-Green
luna-pink Luna-Pink
omega Omega

PREMIUM TEMPLATES

Create awesome applications in no time using the premium templates and impress your users.