different columns number
different columns number
giorg
Posts: 4Questions: 1Answers: 0
Hi,
in my table I need something like this:
<tr>
<th>col 1</th><th>col 2</th>
</tr>
<tr><td colspan="2">subheader</td></tr>
<tr><td>val 1</td><td>val 2</td></tr>
if I remove the subheader row everything works like a charm, but if I leave it I get this error in console:
nTd is undefined
how to solve this?
thanks a lot
This discussion has been closed.
Answers
That doesn't look like valid HTML. You need to have
thead
andtbody
tags. It should look more like this:Datatables doesn't support colspan within the body of the table. It is supported in the header though. Which is probably why you are getting the error. Here is an example:
https://datatables.net/examples/basic_init/complex_header.html
click on the HTML tab to see how this is setup.
Kevin
hi,
thanks for your answer, ofc that was only a part of the table, it is correctly formatted. Unfortunately looks like I cannot use datatables in this particular table, because the body has to be as I mentioned...
thanks
Hi @giorg ,
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin