pdf export not rendering report as expected

pdf export not rendering report as expected

crush123crush123 Posts: 417Questions: 126Answers: 18

I have some export buttons set up on a datatable page, with ajax sourced data where 2 columns are hidden (0 and 3), so i set the export colums to exclude these
(i also tried columns: ':visible;).

if i send the data to print, the hidden columns are not exported.

If I send the data to pdf. the formatting is wrong, the colums are overridden.

http://test3.forthwebsolutions.com/vanilla_ticketsales.php?EventID=126

buttons: [ 
            {
            extend: 'collection',
            text: 'Export',
            buttons: [
                'copy',
                {
            extend: 'excel',
            text: 'Excel',
            filename: 'Event Ticket Sales',
            exportOptions: {
                modifier: {
                    page: 'current'
                }
              }
            },
            {
            extend: 'pdf',
            text: 'PDF',
            filename: 'Event Ticket Sales',
            pageSize: 'A4',
            orientation: 'landscape',
            exportOptions: {
                columns: [1,2,4,5,6,7,8]
            }
            },
            {
            extend: 'print',
            text: 'Print',
            exportOptions: {
                columns: [1,2,4,5,6,7,8]
            }
            },
            ]
        }
    ],

This question has an accepted answers - jump to answer

Answers

  • Tom (DataTables)Tom (DataTables) Posts: 139Questions: 0Answers: 26
    Answer ✓

    For some reason the excel and pdf buttons are using the flash versions. It appears that the dependancy libraries are not being loaded before the buttons code is being executed.

    My guess as to why this is happening is that you are missing the type attribute in your script tag on line 25.

    Could you try that and let me know if it helps?

    Thanks

    Tom

  • crush123crush123 Posts: 417Questions: 126Answers: 18
    edited June 2016

    I have worked it out.

    The order of the scripts is important.

    Adding buttons.html5.js last was the key, it now works great ;-)

This discussion has been closed.