Is it possible to make the background color of a cell in a datagrid depending on if a value is within a range

What I would like to have is that the background of a cell in a datagrid is depending on the value of that cell. The idea is that is the value is within a certain range the background color is green, within another range orange and atherwise red. I have tried the CSS option to select modify the background color on the first character of the titel-tag, i.e. create a class like .customcell td[title^="-" ] div {     color: white;  background-color: red; }     but I was not able to identify a range. To make it more difficult I would like to identify different ranges for different columns. Is that possible? Regards, Peter  
1 answers

Hi Peter,

I would suggest to change the background-color of the td and not the div. 

The way you set it up in your css is: "Selects every <td> element whose title attribute value begins with "-".


On which element did you place the class .customcell?

If the .customcell is placed on the td element then the code would be:

td.customcell[title^="-" ] div {
    color: white;
    background-color: red;

What do you mean with a certain range?