Adding a class to buttons div to hide when printing
Adding a class to buttons div to hide when printing

$('table.basic-datatable-reports').DataTable({
responsive: true,
paging: false,
searching: false, //will need to set this to true when adding filter by column
info: false,
autoWidth: false,
"order": [[0, "asc"]],
dom: 'B<"clear">frtip',
buttons: [
'copyHtml5', 'csvHtml5', 'excelHtml5'
]
});
The above is by datatable and it works great. This table is in a report which user prints. What I want to do is to hide copy/csv/excel buttons when I user is printing the report. I am adding a class hide-for-print to do this. And I am adding this class by searching for dt-buttons class on a page. Is this the best practice to do it? I am hoping datatables will not change/remove dt-buttons class in future as my code is entirely dependent on it.
$(".dt-buttons").each(function () {
$(this).addClass('hide-for-print');
});
Any suggestions/insight would help.
Thanks,
Answers
alan, any help here?