Dynamically customize the header

Dynamically customize the header

WilWorkWilWork Posts: 6Questions: 2Answers: 0

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Hi,

I would like to customize the header of the columns dynamically (js and not in html) by adding for example a menu, a button like the example below. Is this possible?
Thanks

Answers

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    The only thing special about the Datatables header is that it adds click events for sorting. The easiest way to do this is to create a second header with your elements and use orderCellsTop to control which header Datatables uses for sorting.

    Kevin

  • WilWorkWilWork Posts: 6Questions: 2Answers: 0

    Ok thank you.
    I will see to modify the headers of the columns once created by reinjecting html with js.

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    See this example. Its updating the footer but can do something similar with the header.

    Kevin

  • WilWorkWilWork Posts: 6Questions: 2Answers: 0

    Great ! thank you !

Sign In or Register to comment.