Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In ExtJS, how to add a custom CSS class to data grid rows?

How do I add custom CSS classes to rows in a data grid (Ext.grid.Panel)?

I'm using ExtJS 4.0.

like image 228
Erik Kaplun Avatar asked Oct 03 '11 16:10

Erik Kaplun


1 Answers

The way to do it is to define viewConfig on the grid:

Ext.create('Ext.grid.Panel', {
    ...

    viewConfig: {
        getRowClass: function(record, index, rowParams, store) {
            return record.get('someattr') === 'somevalue') ? 'someclass' : '';
        }
    },

    ...
});
like image 85
Erik Kaplun Avatar answered Sep 27 '22 23:09

Erik Kaplun