I rarely use the built-in printing feature. However, for a simple printout of a table, I was bothered by the printing of the
Sum
row as well as the Records 1 to n of m
row.With the following Javascript code, which I put in
hooks/footer-extras.php
, I hide these two lines - but only in the print output:Code: Select all
<script>
// file: hooks/footer-extras.php
jQuery(function () {
jQuery("table[data-tablename] > tfoot").addClass("hidden-print");
jQuery("table[data-tablename] > tbody > tr.sum").addClass("hidden-print");
});
</script>
That's better for me in this case.
Notes
- Change will not yet be visible in print preview page (after clicking [Print Preview]-button) because preview (HTML-) page is still screen-output (
@media = screen
). - Change will be visible in print-preview popup page (your printing dialog) after clicking [Print]-button, as that browser-dialog shows print-output (
@media = print
).
- That script in
footer-extras.php
changes every printout. If you need it for a certain table, only, simply put the javascript code inhooks/TABLENAME-tv.js
. - I've seen a few questions here about hiding this and that in printout. Next to all the given answers of modifying templates etc. you can also use that Bootstrap class
.hidden-print
on the DOM-Elements you'd like to hide in print-output.
I hope this helps someone some day.