ShivaShankar
ShivaShankar

Reputation: 45

Add multiple colours in PrimeFaces dataTable row

Based on drop down values, I want to show data-table row in multi-color. I followed this example but its showing all rows green color or red color

My code :-

<p:dataTable id="empAtendanceTable"
             var="report"
             value="#{empBean.empReport}"
             rowStyleClass="#{report.status==false ? 'colored' : null} #{report.status==true ? 'error' : null}">

CSS :

.colored {
    background: red;
    color: white;
}
.error {
    background: green;
    color: white;
}

How to change the colors? I am using PrimeFaces 5.1 version.

Upvotes: 0

Views: 1079

Answers (2)

Szarpul
Szarpul

Reputation: 1571

try:

 <p:dataTable id="empAtendanceTable"
             var="report"
             value="#{empBean.empReport}"
             rowStyleClass="#{report.status ? 'error' : 'colored'}">

Upvotes: 2

silenum
silenum

Reputation: 179

You need to change the attribute 'background-color'. For example:

.colored {
   background-color: red;
   color. white;
}

That might help you.

Upvotes: -1

Related Questions