Scott Klarenbach
Scott Klarenbach

Reputation: 38721

ExtJS - Dynamically Format GridPanel rows?

I have records with a boolean value, and depending on the boolean value, I would like the GridPanel's rows to be rendered bold. I'm sure there is a nice GridView style way to do this but I can't seem to find it.

Thanks.

Upvotes: 3

Views: 3479

Answers (2)

Brian Moeskau
Brian Moeskau

Reputation: 20429

Your answer is correct, but I want to point out that there's no need to provide an instantiated GridView instance in order to override getRowClass. Use the GridPanel's viewConfig instead:

viewConfig: {
    getRowClass: function(rec, idx, rowPrms, ds) {
        return rec.data.isRead === false ? 'ph-bold-row' : '';
    }
}

Upvotes: 8

Scott Klarenbach
Scott Klarenbach

Reputation: 38721

Nevermind:

view: new Ext.grid.GridView({
            getRowClass: function(rec, idx, rowPrms, ds) {
                return rec.data.isRead === false ? 'ph-bold-row' : '';
            }
        })

Upvotes: 2

Related Questions