Table button pdf
Table button pdf
Ainskognito
Posts: 3Questions: 0Answers: 0
Hi all! I'm from another country, sorry for my English) Please help solve the problem: need before the preservation pdf to the user can specify the orientation. Doing so: table.buttons(0,2).orientation('landscape'); How to do the right?
This discussion has been closed.
Replies
Hi @Ainskognito ,
Take a look at this example here - it's for PDF, but it's the same for the print button.
Cheers,
Colin
I did.
var table = $('#myTable').DataTable({
select: true,
stateSave: true,
"aLengthMenu" : [[ 10, 20, 50, 100, -1],[10,20,50,100,"All"]],
"order": [[2,'desc']],
"displayLength": 25,
dom: 'Bfrtip',
buttons: [
{extend: 'copyHtml5', text: 'Copy'},
{extend: 'excelHtml5', text: '<i class="fa fa-file-excel-o"></i> Excel'},
{extend: 'pdfHtml5', text: '<i class="fa fa-file-excel-o"></i> PDF'},
{extend: 'csvHtml5', text: '<i class="fa fa-file-excel-o"></i> CSV'},
{extend: 'print', text: '<i class="fa fa-file-excel-o"></i> Print'}
]
});
$('#pdf').click(function(){
table.buttons( 0,2 ).orientation('landscape');
});
Not working #pdf
Hi @Ainskognito ,
That demo definitely works - I just tried it . When you say, it's not working for you - what does that mean? Is it showing in portrait, not showing at all?
We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Thanks for the reply. Not working
The user clicks, but orientation remains the same
There is no
orientation
method for the Buttons. Its a configuration option as shown in the example that Colin linked to.Allan