How can I change the style of a particular row based on a condition? I can use JSF EL in rich:column style class attribute, but I have to write for each column. I want to change
Use rowClasses ... You can set a nice zebra style for example, and set a particular color when your value is set to what you want :
Here an example where my value is a boolean. (rowkey is the index of each row, you have to set it as this in rich:datatable :
rowKeyVar="rowkey"
rowClasses="#{myBean.is_validValue == false ? (rowkey mod 2 == 0 ? 'order-table-even-row' : 'order-table-odd-row') : 'found'}"
I set Found class style when ma value == true.
CSS:
.found
{
background-color: #FACC2E;
}
.order-table-even-row
{
background-color: #FCFFFE;
}
.order-table-odd-row
{
background-color: #ECF3FE;
}