Changing table column background color dynamically

Hi All,

How to change the table column background color dynamically based on the table column values? My requirement is,

  1. The user clicks on a command button.
  2. Retrieve the data from database table then check the values of the column from the results provider, based on the column value need to change the background color of a table column say if the values in a column doesn’t exceed greater than 5 then set the column background color to red else to green.

Any help is appreciated.

Hi
in the css properties of the field inside your column you could add something like:

#{order.orderAmount>5?'background-color:green':'background-color:red'}

That would change the style of that single cell.

hope this helps
Javier