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 the entire row.
Thanks
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 the entire row.
Thanks
This is my code, there is a checkbox on each row, if a checkbox is selected, the row is highlighted:
In my backing bean:
I've done an hybrid solution with Javascript.
and then in Javascript (with Prototype which is included in Richfaces)
edit:
this add a conditional css class with rendered:
with javascript I loop on every td with css class expired
$$('td.expired')
and add the same css class to the upper node tr withel.up()
.this simply runs the function when the DOM is fully loaded.
Specifically for each column:
You can use the dataTables columnClasses and rowClasses properties.
That way you can produce the result which is shown here
I do as you've already mentioned and put the style on the column.
However you could always try wrapping all of your columns in a
<rich:columnGroup>
which is supposed to output a<tr>
and place your conditional style on that.EDIT: (in response to comment): if the header facets in your columns are being broken then you can separate them into a column group as well. Should work - you may not even need the column group in the header??
Eg.
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 :
I set Found class style when ma value == true.
CSS: