Search code examples
javascriptdatatableshighlightcolumnsorting

Ordered Column's cell is not highlighted in the JQuery Datatable


When I select a row, the cells of the ordered columns are not being highlighted as you can see below. For example, in my code

  "order": [[0,"desc"],[ 1, "desc" ],[ 7, "desc" ]],

the 7. index column is Created Date and when I click a row, it is not highlighted (as column 0 and 1)

0, 1 and 7th index columns's cells cannot be selected and if I remove those indexes from order : [] then they are selectable.

and when I click a column's header to sort, this cell directly becomes unhighlighted. As I understand, ordered columns cannot be highlighted. How can I make the column 7 highlighted when I select a row?

Update:

I opened the source code and you can see the selected row's html code.

as can be seen, the ordered columns have class names. when I delete the class, everything is OK. so I do not want to change the class or css. is there a way?


Solution

  • I'm suspecting the issue is in the way you decorate selected rows. If you happen to have your selected class assigned to <td> rather than <tr> with some improper selector, the issue like that might raise.

    To fix that problem, make sure selected class is assigned to <tr> upon selection.