Dinamic table headers

Dinamic table headers

m0v3ittm0v3itt Posts: 2Questions: 1Answers: 0

Link to test case: Dont have
Debugger code (debug.datatables.net):
Error messages shown: Dont have any error
Description of problem:
Hi, im new to editor and datables and what i want to this is this:
I have one table that only has dates, i have a form where the user select the first date and the last date and my goal is to generate a table with that days as table headers, can someone help me? Im tired of reading examples and documentation and i dont find nothing with dinamic html column headers

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    You wouldn't find anything in the documentation about it as there isn't a way to dynamically add and remove columns from a DataTable. You could update the text in the header cells (column().header()) and also combine that with column visibility (column().visible()) to create the effect of dynamic columns (.e.g if the max needed is 31).

    Allan

  • m0v3ittm0v3itt Posts: 2Questions: 1Answers: 0

    So let me se if i understand it right, i need to define the number of headers? I cant increment that number?

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

    You could do something similar to this example:
    http://live.datatables.net/huyexejo/1/edit

    It builds the columns before initializing Datatables. It uses columns.title to define the headers.

    If you need to change the configuration of a Datatable then you need to use destroy() and re-initialize with the new options.

    Kevin

Sign In or Register to comment.