DataTables - Hide/Show Columns
<p>I'm trying to Show/Hide columns in DataTables using the Switch Buttons (input checkbox) of Bootstrap.. I have created a functionally <em>a link</em> that work to Show/Hide columns, but when i apply the <em>class</em> and the <em>data-column</em> they don't work with <em>checkbox</em>..
The javascript is this:</p>

<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>                $('.toggle-vis').on('click', function (e) {
                    e.preventDefault();

                    // Get the column API object
                    var column = table.column($(this).attr('data-column'));

                    // Toggle the visibility
                    column.visible(!column.visible());
                });</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;a class="toggle-vis" data-column="7"&gt;Colina&lt;/a&gt;
&lt;input type="checkbox" data-column="0" class="toggle-vis" onchange='OnOff(this, "Carboidrati");' data-label-text="Carboidrati" checked&gt;</code></pre>
</div>
</div>
</p>