Do you know how to hide or show column when datatable's source is javascript?
Methods for showing or hiding columns
table = $('#example').DataTable();
var col = table.column("0").visible(false);
work when data source is directly into html
<table id="example" class="row-border hover">
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger Nixon</td>
<td>System Architect</td>
<td>Edinburgh</td>
...
But it does not work and launch an error when DataTable has a javascript source
var table = $('#example').dataTable({
"data": source,
"columns": columns,
"columnDefs": defs
});
var col = table.column("0").visible(false);//ERROR!
Do you know how to hide a column of Datatables with a javascript source please?