Hide Columns on draw but have as options to show in ColVis

Hide Columns on draw but have as options to show in ColVis

flowteflowte Posts: 21Questions: 6Answers: 0

We are using Buttons 1.0.3 and ColVis with 1.10.10 datatables and would like to draw the table with columns hidden but available through the ColVis button. From the documentation I could not find any way to do this and I wondered if anyone know if/how this can be done?

eg hide column 3 on draw but show in the ColVis button list of available columns (inactive)

<table>
<tbody>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tbody>
</table>
<ul class="dt-button-collection dropdown-menu">
<li class="dt-button buttons-columnVisibility active" tabindex="0" aria-controls="project-list-table"><a>Column 1</a></li>
<li class="dt-button buttons-columnVisibility active" tabindex="0" aria-controls="project-list-table"><a>Column 2</a></li>
<li class="dt-button buttons-columnVisibility" tabindex="0" aria-controls="project-list-table"><a>Column 3</a></li>
</ul>

Thanks

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Answer ✓

    You want the column hidden by default? Just use columns.visible to set the initial visibility state for a column.

    Allan

This discussion has been closed.