Modify heading content when printing
Modify heading content when printing

Have a simple table I'm displaying to the screen. When I click the Print button, I'd like to change the text of some of the header columns. For example, on the screen, I have a column labelled "ABC". On the printout, I'd like the column to be labelled "XYZ",
As always TIA,
Mike
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
This example here isn't quite the same, but it shows how you can modify the header. In that example it's changing the colour, but you can easily change the text in the same block of code.
Colin
Colin,
It works under the pdf button, but under the print button, I get:
index.php:946 Uncaught TypeError: Cannot read property '1' of undefined
at Object.customize (index.php:946)
at _Api.action (buttons.print.js:158)
at q (dataTables.buttons.min.js:13)
at HTMLButtonElement.<anonymous> (dataTables.buttons.min.js:14)
at HTMLButtonElement.dispatch (jquery-3.3.1.min.js:2)
at HTMLButtonElement.y.handle (jquery-3.3.1.min.js:2)
customize @ index.php:946
action @ buttons.print.js:158
q @ dataTables.buttons.min.js:13
(anonymous) @ dataTables.buttons.min.js:14
dispatch @ jquery-3.3.1.min.js:2
y.handle @ jquery-3.3.1.min.js:2
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