How to high light sorted dynamically column
How to high light sorted dynamically column

How to high light column on which basis data table is sorted and Column is dynamically every time (column name not fixed)?
How to high light column on which basis data table is sorted and Column is dynamically every time (column name not fixed)?
Replies
This example shows the CSS selector needed to highlight sorted columns. See the CSS tab.
https://live.datatables.net/nehehuku/1/edit
Not sure what you mean by this. If the above doesn't help then please provide a simple test case showing the dynamic column so we can offer suggestions.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Column name change every time but how to active column name on which it seems to be sorted.
The example I linked to above doesn't rely on the column name. The sorted column can change and the CSS will apply the appropriate highlight styling.
Its possible that I don't understand what you are trying to achieve. Again if you need help with this then please provide a simple test case that shows what you have so we can offer more specific suggestions.
Kevin
Maybe you are asking about highlighting a column. See this example:
https://live.datatables.net/loheyupe/85/edit
The example shows highlighting all the cells in a row, highlighting all the cells in a column and highlighting the
tr
.Kevin
In this test case (building on kthorngren's), the ordered column is highlighted each time the table is ordered:
https://live.datatables.net/loheyupe/86/edit
I don't know why the
draw
event doesn't fire on init here, in my own script it does.Edit: actually it's running one ordering behind, I guess the
sorting_1
class is only added after the draw (which makes sense now that I think about it).Edit2: Ok now it works, except still on init.
@bur use the
order
event and initialize it before initializing Datatables. Like this:https://live.datatables.net/fakoteqe/1/edit
Code might need to be added for the case of the third click removing ordering on the column.
Kevin