tags:

views:

168

answers:

1

Hi,

i am populating a jqgrid from database and one of its columns is a color column like red, blue, etc. Can i set the cell color of this column based on the value coming from database at run time? how should i set formatter in this case? i tried like this but do not work

var colorFormatter = function(cellvalue, options, rowObject) {
        var colorElementString = '<div class="colorBlock" style="background-color: red;"></div>';
        return colorElementString;
---
---
colModel: [
                { name: 'GroupName', index: 'GroupName', width: 200, align: 'left' },
                { name: 'Description', index: 'Description', width: 300, align: 'left' },
                { name: 'Color', index: 'Color', width: 60, align: 'left', formatter: colorFormatter}],
A: 
Harry