Print button results in printed header with Exported data

Print button results in printed header with Exported data

Sasori7Sasori7 Posts: 26Questions: 10Answers: 0
edited January 24 in DataTables 1.10

using DataTables 1.13.8, Buttons 2.4.2, HTML5 export 2.4.2, Print view 2.4.2:
let table = new DataTable('#historyTable', {
lengthMenu: [
[-1, 10, 25, 50, -1],
['ALL', 10, 25, 50]
],
buttons: ['print'],
dom: '<"my-custom-title"><"top"Bf>rt<"bottom"ip><"clear">'
});

I've been trying to get the heading that I have into the actual print from the print button. However, I only get a giant, "Exported data" on the top of the page.
I've tried various solutions found online, but they're probably for older versions of datatables.
For example, I tried this solution: https://github.com/aravindnc/Buttons/wiki/How-to-add-title-and-image-header-to-all-pages-while-printing-using-DataTable but it didn't work.

can you please help?

Answers

  • kthorngrenkthorngren Posts: 20,322Questions: 26Answers: 4,774

    See if this example answers your questions.

    Kevin

  • allanallan Posts: 61,743Questions: 1Answers: 10,111 Site admin

    I've been trying to get the heading that I have

    What heading?

    Are you able to give me a link to the page in question please?

    The title and messageTop options of print can be used to set the content that appears at the top of the print output.

    Allan

Sign In or Register to comment.