Set column header text

Set column header text

N0tChrisN0tChris Posts: 7Questions: 0Answers: 0


I'm looking for a simple solution to set column header text in a table using complex headers (with colspan).
I know that we can loop on each column and log headers with this code :

table.columns().every(function () {
    // Here, I want to set column header text 

But, it doesn't display column headers with colspan attributes...

Thanks for your answer!


  • kthorngrenkthorngren Posts: 18,164Questions: 25Answers: 4,304

    The column().header() docs state this:

    The cell return is the one used by DataTables for adding the ordering click listener. If you have multiple cells in a header (i.e. multiple rows), which one DataTables uses as the primary header cell is defined by the orderCellsTop option.

    You can use standard jQuery or Javascript methods to make changes to the header text.


  • N0tChrisN0tChris Posts: 7Questions: 0Answers: 0

    Thank you for your support. I find a way with jQuery as you suggested!

Sign In or Register to comment.