How to change the cell colour based on the value of the cell in jqgrid

901 views Asked by At

I have a sample colModel which has all the marks of the students. And If the students mark is less than 50,I want to displaay the cell in RED colour and above 50 as green colour. Another scenario where The cell colour depends on the other column value. Is it possible to achieve these cutom options in jqgrid. Thanks in advance.

1

There are 1 answers

0
Oleg On

I seems to me you need just use cellattr callback in the corresponding column. See the answer and this one (or this one if you use datatype: "xml") for the code example. Inside of cellattr callback to the value of the current column, rowid and to the values from all other columns to the row too. So you can set dynamic value of class attribute for the cells of the column of set dynamic (different) values of style attribute.