printing a page (that contains DT) in Chrome

printing a page (that contains DT) in Chrome

veloopityveloopity Posts: 79Questions: 32Answers: 2

https://www.investmentfonds.de/datatables_test.cfm
(This is a test page from a website that contains Datatables in several places. The website is based on MySQL/Lucee and Tailwind CSS. The datatables use Ajax - should you get an Ajax error, please reload the page.)
The Datatables internal print function (launched from the "Nur Tabelle drucken" button) works well in all browsers but we also need to be able to print the complete page. This works well in Firefox but not in Chrome/Edge: While Firefox prints the complete datatable, Chrome/Edge prints a datatable that is cut off and contains a scrollbar.
So far, we haven't been able to locate the reason for this behaviour. Does anyone have an idea?

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 17,295Questions: 25Answers: 4,109

    That's a function of the browser not Datatables. Looking at Firefox it looks like it defaults to "Fit to page width":

    However Chrome doesn't. But you can adjust the scale:

    Kevin

  • veloopityveloopity Posts: 79Questions: 32Answers: 2

    thx Kevin - can I change this into a discussion? my colleague might want to comment also. I put this into "ask a question" before thinking

  • kthorngrenkthorngren Posts: 17,295Questions: 25Answers: 4,109
    edited July 26

    I don't believe there is a way to move the discussion. Your colleague can post questions into this thread. However if its a question browser specific question please use Stack Overflow instead.

    Kevin

  • veloopityveloopity Posts: 79Questions: 32Answers: 2
    edited July 26

    (Colleague sees this page but without the comment section)

    Is there any DataTables option for ColumnDefs to hide/suppress it for printing? We believe the Tailwind CSS combination MediaModifier:Class (here: print:hidden) could be the culprit, so we are looking for a native DT solution.

  • kthorngrenkthorngren Posts: 17,295Questions: 25Answers: 4,109
    Answer ✓

    (Colleague sees this page but without the comment section)

    Is your colleague logging into the forum?

    Datatables has no interaction with the browser's print function so it won't have any options to change table attributes when you use the browser's print. You might be able to detect the browser's print event and use something like columns().visible() to hide columns. See this SO thread for some ideas. Capturing the browser's print event or modifying the default browser behavior is outside the scope of this forum.

    Kevin

Sign In or Register to comment.