Hi,
Please try below code.
table.columns(dtableCols).visible(false);
Where dtableCols is an array of all column ids. eg: [0,1,2,3,4,5]
Or
Use class name assigned to th element in table header (col-hide in my example) in targets option (without the leading dot .) to target certain columns and visible option to make these columns hidden.
"columnDefs": [
{ targets: "col-hide", visible: false }
]
for instance
$('#example').DataTable( {
"responsive": true,
"columnDefs": [
{ targets: "col-hide", visible: false }
]
} );
for demo refer jsfiddle