Complex header from json source

Complex header from json source

ofearofear Posts: 4Questions: 0Answers: 0
edited November 2013 in General
Hi, I'm using the latest version and I'm trying to create a header with two rows in it.
You can see what I meaning from this example:
http://www.datatables.net/blog/Creating_beautiful_and_functional_tables_with_DataTables

Now, I'm building all the table from json and this is my code :
http://jsfiddle.net/TDtue

As you can see it's one row in the header , But I need to know how to create the html table with two rows in the header.

I searching for almost 6 hours for an example of how to create it from a JSON source with no luck.

Please help!

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    DataTables will not create headers with colspan / rowspan. You need to use standard jQuery / DOM methods to create such a header yourself.

    Allan
  • ofearofear Posts: 4Questions: 0Answers: 0
    So to understand what you saying... There is no option to create two rows in the table via json alone..
    I will have to append another to the after the datatabled() function completed?
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    That is correct yes. Or you could construct the header before the DataTable is initialised. Either way, DataTables cannot create a header with colspan / rowspan automatically. It would be far too complicated / too much code, to add that feature into DataTables.

    Allan
  • ofearofear Posts: 4Questions: 0Answers: 0
    Allan, Thanks You very much!
This discussion has been closed.