title: Datatables: How to create a dropdown for the button "column Visibility"?
body: <p>I'm currently doing a datatables.
  I would like to have a dropdown to show/hide the columns.</p>
  <p>I read the doc. I read lot of threads on StakOverflow.
  However i didn't find the solution.</p>
  <p>I made the button but it generates as many buttons as columns.</p>
  <pre><code>        dom: 'Blfrtip',
      buttons: [{
          extend: 'csv',
          text: 'Export',
          className: 'btn btn-secondary',
          charset: 'UTF-8',
          fieldSeparator: ';', // with ';' we can export the file in csv and each column is in one column. Without ';' everything is in one column
          exportOptions: {
              columns: [tablecolumnsforexport] // display only the columns defined before. In this case : we don't display the first and the last columns
          },
          bom: true
      }, {
          extend: 'colvis',
          text: 'columns visibility',
          postfixButtons: ['colvisRestore']
      }]
    
  </code></pre>
  <p>The current result:</p>
  <p><a href="https://i.stack.imgur.com/qJ8NX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qJ8NX.png" alt="enter image description here" /></a></p>
  <p>To be more specific, I want something like that (in the red square) :
  <a href="https://i.stack.imgur.com/mNXtw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mNXtw.png" alt="enter image description here" /></a>
  I already created the buttons print and column visibility.
  Do you know how to create a dropdown with all the columns'name?</p>
  <p>EDIT: To be very clear, I don't want to filter to find a row. I want to show or hide one, some or all the entire columns.</p>