I want to allow the user to select a column by clicking on the header. I’ve added a callback for the onBeforeSorting and returned false to stop sorting. Is there a way to set the header color from this callback? I’m loading the rows from loadXML(), so I don’t implement the grid from a table.
I was thinking just adding and removing a style class but my issue is I don’t know how the table is structured.
On the before sorting callback I add the class like:
//columnIndex is the column passed into the callback
var newSelectedColumn = grid.hdr.rows[1].cells[columnIndex];
newSelectedColumn.setAttribute(‘class’, (((newSelectedColumn.getAttribute(‘class’) != null) ? newSelectedColumn.getAttribute(‘class’) + ’ ’ : ‘’) + ‘selected’));
Bumping this because I really want to find out how to color the header. Above I showed the style I was trying to apply when using the suggested method to get the column header html tag. I got the html tag and added the style in javascript but it doesn’t seem to show, almost like they are setting an image as the header.
Issue occurs because of native grid header styles has highter priority then style of the cell with .selected class. To fix ti you should define .selected class like following:
div.gridbox_dhx_skyblue table.hdr td.selected {
color: yellow;
background: yellow;
background-color: yellow;
}
change “_dhx_skyblue” to the name of grid skin which you are using.
Get a guaranteed answer from DHTMLX technical support team
under the most suitable support plan