Change grid color in ExtJs

How to get the color of a backgroud or text from the first five lines, which will be different from the next five lines. For example, the first 5 yellow, 5 orange, 5 yellow, 5 orange, etc.

I added the following listener for the grid

listeners: { viewready: function(g) { g.getView().getRow(1).style.color="#f30"; } } 

I used this to get the contents in the second line in red.But this does not work for me.

+4
source share
2 answers

You can use your own GridView getRowClass method:

 var mygrid = new Ext.grid.GridPanel({ viewConfig: { getRowClass: function(record, index, rowParams) { return (Math.floor(index / 5.0) % 2 == 0) ? 'rowClass1' : 'rowClass2'; } } }) 

Then define a class of custom string classes on your page or in your CSS.

+7
source

Source: https://habr.com/ru/post/1399975/


All Articles