ColumnControl - inserted instead of in
ColumnControl - inserted instead of in

Link to test case:
https://github.com/DataTables/ColumnControl/blame/a334ecc37062fa42250bf8684a9144ebcade0898/js/dataTables.columnControl.ts#L180
Description of problem:
Hello,
When importing ColumnControl in an app, all the table headers have td child elements instead of th, even when the extension is not enabled for a particular table.
Is this behavior expected ? Shouldn't the line linked above be rather:
tr.appendChild(createElement(isHeader ? 'th' : 'td'));
?
Best regards,
Thibault
Answers
Hi Thibault,
Thanks for your question. That's intentional -
td
is a valid tag to use in thethead
row and I was generally expecting any rows in the ehader that are dynamically added to not be the header cells (more likely to be used for search boxes, which are not headers - there would likely be ath
above them).On that assumption I think
td
is semantically the correct one to use.That statement bothers me though. ColumnControl shouldn't be doing anything on a table that it isn't enable for. Can you give me a link to a test case showing the issue so I can take a look into what is happening there please?
Thanks,
Allan
Hello Alan,
Sorry for the delayed answer, I was on Holidays.
Thank you for your answer.
Here is two jsfiddles to reproduce what I observe. Two simple examples that use js as data source with boostrap5 for styling.
Without ColumnControl:
https://jsfiddle.net/g7pzxhm9/4/
With ColumnControl (But not activated for the table ! Only imported as an asset):
https://jsfiddle.net/bhdkaqgp/
As you can see it replaces the th by td, which breaks the boldness of the original table and also removes the ordering icons.
Best regards,
Thibault