Search code examples
javascriptextjsextjs4

In ExtJS, how do you set the background color of a row in a Ext.grid.EditorGridPanel


I have an ExtJS web application in which I need to set the colors for the rows of an Ext.grid.EditorGridPanel.

What I need to do is to set the color based on the value of one of the fields in the row.

It seems like this should be pretty easy - but so far I've spent hours on this with no luck.

Any suggestions?

Thanks!


Solution

  • Use something like below. This will add a class to each row. You can then add some CSS to style the row based on its class.

    getRowClass: function(record) {
            return record.get('parameter_1') === 'value1' ? 'class-1' : 'class-2';
        }
    },