ColumnControl - inserted instead of in

ColumnControl - inserted instead of in

VynskirVynskir Posts: 7Questions: 3Answers: 0

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

  • allanallan Posts: 64,677Questions: 1Answers: 10,696 Site admin

    Hi Thibault,

    Thanks for your question. That's intentional - td is a valid tag to use in the thead 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 a th above them).

    On that assumption I think td is semantically the correct one to use.

    even when the extension is not enabled for a particular table.

    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

  • VynskirVynskir Posts: 7Questions: 3Answers: 0

    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

Sign In or Register to comment.