monstergold
monstergold

Reputation: 755

Set Row Style without using a CSS class

I'm working on Extjs 4.2 with a Ext.grid.Panel and I have to set programmatically the color of each row in the grid.

My first option is to use the "getRowClass" in viewConfig by returning a css class name like in the example of Skirtle's Den HERE. But my color is define by the user dynamically and I don't want to create a css file with all possible color.

My second option is to use the rowParams in "the getRowClass" like THIS but for 4.2 the rowParams is deprecated.

I can also override the rowTpl in viewConfig or set the color of each cell of a row thanks to meta.style in the renderer function from Ext.grid.colum.Column but maybe do you know an easier way to do that?

Upvotes: 0

Views: 1061

Answers (1)

Saki
Saki

Reputation: 5856

Try this:

Ext.fly(grid.getView().getNode(2)).setStyle({background:'yellow'});

I would set 3rd row of the grid to yellow, however, you still need to switch off the backgrounds of individual cells.

Upvotes: 0

Related Questions