0

I want to change background colors(say,red) of all cells in a column(say, Total Sale) where column value is more than x(say, 10)? How can this be achieved.

john doe
  • 806
  • 3
  • 14
  • 28
  • 1
    Please show the code that you've already tried. – hlh3406 Feb 05 '16 at 08:31
  • You need just use `cellattr` in the column. See [the old answer](http://stackoverflow.com/a/12180842/315935) with [the demo](http://www.ok-soft-gmbh.com/jqGrid/addclasstocolumn.htm) – Oleg Feb 05 '16 at 10:27

1 Answers1

1

You can use formatter for total column.

{
    name: "total",
    index: "total",
    formatter: function(cellvalue, options, rowObject){
        if(cellvalue>10)
            return '<span style="background-color: red; display: block; width: 100%; height: 100%; ">' + cellvalue + '</span>';
        else
            return cellvalue;
    }
}

DEMO

Ibrahim Khan
  • 20,616
  • 7
  • 42
  • 55