Print Button: keep classes in cells and rows
Print Button: keep classes in cells and rows
From the documentation (https://datatables.net/reference/button/print) I got the following:
The constructed table does not retain the full information from the original table (table row and cell classes are not copied across for example), but the stylesheets from the original document are copied to the print document so the basic styling of the table can be retained.
Why are the classes not copied? Is there a specific reason?
e.g. I want to keep styling classes like (using bootstrap theme) text-nowrap and maybe text-right or text-center...
I've located the function in the plugin where the table is copied. Should I change my copy of this plugin to fit my needs or should I manipulate the copied table via the customize function of the print plugin?
This question has an accepted answers - jump to answer
Answers
Yes - performance. It is slow to read the class names and then apply them in the generated document. It is certainly possible, and you could modify the code to have it do that but it doesn't do it at the moment. Perhaps a good idea for a future enhancement that you could optionally enable, acknowledging the performance cost.
Regards,
Allan
ok thanks.
For the moment, I manipulate the DOM with following commands to apply some extra styling:
hey , i have a similar problem, i need mantein the align like the original table when i print, i have 6 columns, only the 5 and 6 have className: 'text-right', targets: [6].
can you tell me an idea how to keep this? thanks you
i used that w.find('td:nth-child(1)').addClass(,) , problem solved!