print preview does not show any data in jQuery data table

print preview does not show any data in jQuery data table

motalibmotalib Posts: 1Questions: 1Answers: 0
edited March 2022 in Buttons

DataTables is incredible!! I keep finding new features that make me fall in love all over again. The most recent is the Buttons extensions...I'm working on implementing Copy, Excel, PDF, and Print. The first three are working with no issues, but Print is giving me problems. When trying to print, if I click the Print button, the new tab opens up and I can see that the table is getting fully populated before being covered by the print preview. The print preview only shows the title of the page and does not show the data table at all. Here is my code.

$("#task_table_list").DataTable({
        dom: "fBrt",
        buttons: [
            {
                extend: 'copy',
                text: '<i class=" icon-file-openoffice position-left"></i>',
                "className": 'all_button'
            },{
                extend:'pdf',
                text:'<i class="icon-file-pdf position-left"></i>',
                "className": 'all_button'
            },
            {
                extend:'csv',
                text:'<i class="icon-file-excel position-left"></i>',
                "className": 'all_button'
            },
            {
                extend:'print',
                text:'<i class="icon-printer position-left"></i>',
                "className": 'all_button',
                // "autoPrint": false,
                exportOptions: {
                        stripHtml: true
                },
                exportOptions: {
                    modifier: {
                        page: 'current'
                    }
                },
            },

        ]
    })

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 14,610Questions: 1Answers: 2,493

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. 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

Sign In or Register to comment.