Set column header text

Set column header text

N0tChrisN0tChris Posts: 7Questions: 0Answers: 0

Hello,

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 () {
    console.log(this.header());
    // Here, I want to set column header text 
})

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

Thanks for your answer!

Replies

  • kthorngrenkthorngren Posts: 20,139Questions: 26Answers: 4,734

    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.

    Kevin

  • 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.