Printing - Getting one header per page instead of multiple
Printing - Getting one header per page instead of multiple
jcorreia
Posts: 2Questions: 1Answers: 0
Hi!
I'm trying reproduce the print customisation example. But this is the result:
https://jsfiddle.net/ae4jxwLk/1/
But instead of getting one header per page when printing, i'm getting multiple headers per page.
My code:
$(document).ready(function() {
$('#table').DataTable( {
dom: 'Bfrtip',
searching: false,
buttons: [
'csv', 'excel',
{
extend: 'print',
customize: function ( win ) {
$(win.document.body)
.css( 'font-size', '16pt' )
.prepend(
'<img src="assets/images/logo.png" style="top:0; left:0;width:400px;" />'
);
$(win.document.body).find( 'table' )
.addClass( 'compact' )
.css( 'font-size', 'inherit' );
$(win.document.body).find( 'td' )
.css('text-align','center')
.css('vertical-align','middle');
$(win.document.body).find( 'th' )
.css('text-align','center')
.css('vertical-align','middle');
}
}
],
language: {
"sProcessing": "A processar...",
"sLengthMenu": "Mostrar _MENU_ registos",
"sZeroRecords": "Não foram encontrados resultados",
"sInfo": "Mostrando de _START_ até _END_ de _TOTAL_ registos",
"sInfoEmpty": "Mostrando de 0 até 0 de 0 registos",
"sInfoFiltered": "(filtrado de _MAX_ registos no total)",
"sInfoPostFix": "",
"sSearch": "Procurar:",
"sUrl": "",
"oPaginate": {
"sFirst": "Primeiro",
"sPrevious": "Anterior",
"sNext": "Seguinte",
"sLast": "Último"
}
}
} );
});
What i'm doing wrong?
EDIT: link replaced with a fiddle link
EDIT2: i want to print this table in landscape mode
This discussion has been closed.
Answers
Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.
Information on how to create a test page, if you can't provide a link to your own page can be found here.
Thanks,
Allan
Hi Allan!
Just updated the link with a example fiddle.
Thanks. It looks like a Chrome bug to me. I've tried it in Edge, Safari and Firefox as well and they all print as would be expected with a single header per page. Chrome is the only one that will show multiple copies of the header.
I'd suggest copying the HTML from the generated page and opening an issue on the Chromium bug tracker to see what the Chrome team say.
Allan