DataTable - Color

Certain rows can be styled based on a condition using rowStyleClass. Table below highlights cars that are manufactured before 1990.

Documentation
IdYearBrandColor
852597611993HondaYellow
f1ef65541972FiatOrange
e24378911995RenaultMaroon
7fbada1a1998RenaultYellow
2f2abb2d2009FiatSilver
99d56cd71987MercedesBrown
d2e6f1711980MercedesRed
c3bf6d0c1984MercedesBlue
eff3cc3d1966FiatBlue
3bfff8831978BMWOrange
<style type="text/css">
    .old {
        background-color: #fca752 !important;
        background-image: none !important;
        color: #000000 !important;
    }
</style>

<p:dataTable var="car" value="#{dtBasicView.cars}" rowStyleClass="#{car.year le 1990 ? 'old' : null}">
    <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: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.