Modify heading content when printing

Modify heading content when printing

mbornmborn Posts: 44Questions: 17Answers: 0

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

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    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

  • mbornmborn Posts: 44Questions: 17Answers: 0

    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

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    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

This discussion has been closed.