data-visible="false" hides header but not data

data-visible="false" hides header but not data

geigerzaehlergeigerzaehler Posts: 1Questions: 1Answers: 0

I’m using <th data-visible="false"> to hide a column but it only hides the header element (<th>) and not the data elements (<td>). This is on v2.0.2 and it used to work with 1.13.

Heres a link to a reproduction: and here is the code.

<table id="example" class="display" style="width:100%">
      <th>Hidden by column-defs</th>
      <th data-visible="false">Hidden by attribute</th>
      <td>Tiger Nixon</td>
      <td>Hidden value</td>
      <td>Hidden value data-visible</td>
<script src=""></script>
<script src=""></script>
    columnDefs: [{targets: [1], visible: false}]

I would expect the cell “Hidden value data-visible“ not to be visible.

As a workaround I’m using the following code:

$("#example").DataTable().columns().every(function () {
  if (!this.visible()) {
Sign In or Register to comment.