Home > JavaScript > Extjs change grid cell background based on value

Extjs change grid cell background based on value

October 20th, 2014 Leave a comment Go to comments

If you want to change the color of a Grid cell Grid, use the renderer attribute.
Example: Suppose you have a cell that has a numeric value. If this value is greater than 0, then the background color is green, otherwise it is red.
Here’s a code that describes:

renderer : function(v, md) 
{
    if(parseInt(v) > 0)
        md.style = "background-color:green;";
    else
        md.style = "background-color:red;";
}
  1. No comments yet.
  1. No trackbacks yet.