Problem with column color with sorting - very strange

Hello

I am trying to Paint column in yellow when I am sorting the current column.
I tried to do it with “onAftersorting”/“onBeforesorting” Event , on the event i am calling to
setColumnColor(colorString) function.
I tried to Debug and saw that everything looks fine, the setColumnColor function get the right
colorString, but the column colors on the web are not on the right column and just several rows were painted without any connection to the colorString I gave.

hope someone can help me.

Thank You, :smiley:

setColumnColor can be used only before data loading.
When data is loaded it will not have any visible effect anymore.

Instead of it you can use something link

grid.forEachRow(function(id){ grid.setRowTextStyle(id,"background-color:yellow;"); });

Hi

Thanks, but it’s not solving my problem.
I need to change specific column color, not row color.

Sorry, just mistyped solution a bit
For column it will look as

grid.forEachRow(function(id){ grid.setCellTextStyle(id,index,"background-color:yellow;"); });

where index - index of column in question

Great thanks

You helped me a lot.
I got one more problem - when the column is colored in yellow the color of the selected row (with the mouse) is disapeared and the mouse hovering color is disapeared too.
What can I do with it ?

As for covering class - you can add !important declaration for the background style

.some { background-color:red !important; }

So it will be rendered on top of column color.
For row selection, the same can be done through modification of dhtmlxgrid.css

Hi

The issue with the afterSorting column color looked fine till I tried to sort and mark the sorted column of very big grid with alot of rows, When the grid is big there are problems with the marking, alot of rows are not marked after sorting.

Thanks,

This is expected behavior if you are using Smart Rendering mode. It not possible to change style of the row if it wasn’t rendered yet.

Hi

Is it possible to paint the next rows (in smart rendering) by override some method?

thanks,

alot of rows are not marked after sorting.
You can paint all rows, but it will slowdown grid rendering.

for (var i=0; i<grid.getRowsNum(); i++){ grid.render_row(i); grid.setCellTextStyle(grid.getRowId(i),index,"background-color:yellow;"); };