Merging columns AND their titles?

Merging columns AND their titles?

MoghulMoghul Posts: 7Questions: 3Answers: 0

I have managed to merge one column's data into another by using render but the title (or header) still only the original column's title.

Is there any way to merge those too? I understand that I can just start out with the right value, but I would need a more generic solution for my purposes.

Answers

  • kthorngrenkthorngren Posts: 20,313Questions: 26Answers: 4,771

    You can use columns.title to set the header title. But you would need to know what this is before Datatables initializes and use a variable to set it. Otherwise, one option might be to use initComplete along with jQuery to set the title after initialization. Something like this maybe: $('#example th:eq(1)').html('Test');.

    Kevin

  • MoghulMoghul Posts: 7Questions: 3Answers: 0

    That's kind of unfortunate. I was hoping there would be an option within DataTables, rather than having to make custom code.

    Thanks either way.

This discussion has been closed.