How to uncheck columns in "show / hide columns" button list.
How to uncheck columns in "show / hide columns" button list.
Hi I'm new to Datatables so please excuse the following dumb question. I'm using the following table initialisation:
$(document).ready(function() {
var t = $('#example').DataTable( {
"dom": 'C<"clear">lfrtip',
colVis: { exclude: [ 0,1,3 ] },
"paging": false,
"responsive": false,
"columnDefs": [ {
"searchable": false,
"orderable": false,
"targets": 0
} ],
"order": [[ 3, 'desc' ]]
} );
t.on( 'order.dt search.dt', function () {
t.column(0, {search:'applied', order:'applied'}).nodes().each( function (cell, i) {
cell.innerHTML = i+1;
} );
} ).draw();
} );
This gives me a table which datatables calculates the column number, and recalculates the column number on re-order and/or search. I have also turned off paging and am displaying the ColVis "show / hide columns" button. What I now want to do is uncheck a couple of columns in the "show / hide columns" button list but so far have been unsuccessful, can anyone tell me how I add this?
Answers
It seems that the following columnDefs cannot co-exist?
Anyone have any idea why?