PDF export not showing all of table

PDF export not showing all of table

colinodcolinod Posts: 3Questions: 2Answers: 0
edited November 2016 in Free community support

I have a large table with 52 columns and when i export to pdf it is only showing what is on the page and not doing more pages for more columns.

Also i have a header with two rows and it is not showing both rows

the page is hidden behind a login so cannot show on here but code for datatable is

$(document).ready(function() {
    $('#example').DataTable( {
         "lengthMenu": [[100, 250, 500, -1], [100, 250, 500, "All"]],
        dom: 'Blftip',
        select: true,
        "scrollY": 600,
        "scrollX": true,
        buttons: [
        
        {extend: 'excel',
        footer: 'true',
        text: 'Excel',
        title:'Statistics'  },
        
        {extend: 'pdf',
        footer: 'true',
        text: 'pdf',
        orientation: 'landscape',
        title:'Statistics'  },
        
        'print',
            
        {extend: 'excel',
        text: 'Selected Excel',
        footer: 'true',
        title:'Statistics',
        exportOptions: {
        modifier: {
        selected: true
                }
            }
        },
        {
        extend: 'pdf',
        footer: 'true',
        orientation: 'landscape',
        title:'Statistics',
        text: 'Selected PDF',
        exportOptions: {
        modifier: {
        selected: true
                        }
                    }
                }
        ]
    } );
} );

Answers

  • a8150242a8150242 Posts: 3Questions: 1Answers: 0
    edited December 2016

    yes,if the data processing server,datatables-buttons-pdf can`t export all of columns but export a page of data.

    my solution:when you chick the button(pdf),start a new ajax to get all of data

    after my test,the datatables-buttons-excel is working maybe the pdf is also working!

    datatables.js:

    var _exportData = function ( dt, inOpts )
    {
        // fucking do something you want
        var config = $.extend( true, {}, {
            rows:           null,
            columns:        '',
            modifier:       {
                search: 'applied',
                order:  'applied'
            },
            orthogonal:     'display',
            stripHtml:      true,
            stripNewlines:  true,
            decodeEntities: true,
            trim:           true,
            format:         {
                header: function ( d ) {
                    return strip( d );
                },
                footer: function ( d ) {
                    return strip( d );
                },
                body: function ( d ) {
                    return strip( d );
                }
            },
    //add ajax start
            ajax: {
                async: false,
                dataType: 'json',
                url: '',
                data: dataMap,
                type: 'post'
    
            }
    //add ajax end
        }, inOpts );
    
    

    ps:happy to coding!!!

    LiuWei

  • colinodcolinod Posts: 3Questions: 2Answers: 0

    I do not use json to call my data it is loaded into a table in the same page using classic asp.

    will this matter as i am unsure how to use this

    Thanks for your help

This discussion has been closed.