Complex header : Using a colspan=2 breaks the whole Datatable
Complex header : Using a colspan=2 breaks the whole Datatable
cyrille.duverne
Posts: 1Questions: 0Answers: 0
Link to test case: https://live.datatables.net/cubitadi/1/
Debugger code (debug.datatables.net): epezac
Error messages shown: "Uncaught TypeError: oCol is undefined"
Description of problem:
Whenever I try to use a colspan in the thead section, the code breaks and an extra <th> is added to the code.
I followed this doc : https://datatables.net/examples/basic_init/complex_header.html
Could you please help ?
I'm not a huge Js expert...
Replies
You defined 6
th
tags for the header. Datatables sees this as 6 columns not 7 because of thecolspan
:The table has 7 columns of data:
One option is to create two
th
tags for the Action column, like this:https://live.datatables.net/cubitadi/2/edit
The other option is to combine the Action elements into one cell, like this:
https://live.datatables.net/zuqojepe/1/edit
Also you should create the
tbody
. The closingtr
tag for each row should be</tr>
. See my note in the above code snippet.The HTML docs provide the Datatables requirements for the HTML table.
Kevin