Table button pdf

Table button pdf

AinskognitoAinskognito Posts: 3Questions: 0Answers: 0
edited September 2018 in Free community support

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?

Replies

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @Ainskognito ,

    Take a look at this example here - it's for PDF, but it's the same for the print button.

    Cheers,

    Colin

  • AinskognitoAinskognito Posts: 3Questions: 0Answers: 0
    edited September 2018

    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

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    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

  • AinskognitoAinskognito Posts: 3Questions: 0Answers: 0
    edited September 2018

    Thanks for the reply. Not working

    $('#pdf').click(function(){
    table.buttons(  0.2 ).orientation('landscape');
    }); 
    

    The user clicks, but orientation remains the same

  • allanallan Posts: 63,455Questions: 1Answers: 10,465 Site admin

    There is no orientation method for the Buttons. Its a configuration option as shown in the example that Colin linked to.

    Allan

This discussion has been closed.