I use several datatables on a single html page which is a report. I use pagination and column management which are all managed through javascript on the jquery document ready. All works fine - no problem.
When I print I need to specify different datatable settings - mainly to remove pagination for each grid. If it was css, you would just use the media tag. Is there any way to do something similar with javascript?
Using datatables print functions is not a solution as I need to print the whole report including the html around it.
One option I will probably implement if I dont get any better suggestions is Leo Lam's suggestion here; run-javascript-jquery-only-on-screen-media-not-print
Example of my config FWIW - the main change necessary would be to add paging: false on print and remove it on screen.
$(document).ready(function() {
var muttable = $('#mut-table').DataTable(
{ searching: false,
"columnDefs": [
{
"targets": 5,
"visible": false,
"bAutoWidth": false,
},
{
type: 'alt-string', targets: 4
}
],
order: [[ 4, "asc" ],[ 5, "desc" ]],
} );
});
@media printrule? (And pop up a page for printing)@media printcss rules should take effect-- I was thinking you could use them for pagination at that point.