Why does hiding a column shrink my table?

Why does hiding a column shrink my table?

RhendarRhendar Posts: 13Questions: 4Answers: 0

I am attempting to add a hidden column to my datatable. I set it up in the Columns definitions to add a CSS class to the last column. That CSS class simply sets the display to none thus hiding the column. It appears to be working however it's shrinking my table for some reason. Why is it doing this?

table

var table = $('#tblDisplayListOld').dataTable({
"columns": [
null,
null,
null,
null,
null,
null,
{ className: "hide_column" },
]
});

.hide_column{
display: none;
}

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599
    Answer ✓

    You can use columns.visible for that.

    If you want to do it via CSS, 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

This discussion has been closed.