Create header titles within datatables

Create header titles within datatables

islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

Is there any way I can create the header titles inside datatables and not in the HTML? As the header titles I get them using a dynamic ajax call ...

Replies

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

    Use columns.title for this.

    Kevin

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1
    edited May 2018

    Thanks!

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1
    edited May 2018

    Is there now a way to create X number of <th> in footer depending on the number of titles/columns dynamically?

    I tried doing it using just normal JS in a loop to give me the exact amount :

    $('table>footer>tr').append('<th></th>');
    

    But datatables doesn't like this, he ignores it, as if it didn't exist. Is there a reason why datatables wouldn't use the pre-created th's in JS right before the initialization of datatables?

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

    Figured it out, thanks anyway ! :)

This discussion has been closed.