Change datatable Column color on click
Change datatable Column color on click
knight08
Posts: 3Questions: 2Answers: 0
Can we change the column color in a datatable on click? example: color of column changes to yellow when clicked on table heading.
Answers
Sure whenever the data table is drawn add your event handler.
Check "Reference", "Events" for the "draw" event and other suitable events.
colum().nodes() could be useful to select the column that you want to change.
https://datatables.net/reference/api/column().nodes()
To select a table header you could assign a class in your <th> tag in your HTML and then take it from there:
this helped. thank you