printing a page (that contains DT) in Chrome
printing a page (that contains DT) in Chrome
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
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
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
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
(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.
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