customizing the print file to include table styling
customizing the print file to include table styling
Greetings,
I am trying different ways to keep the table styling when I print a data table. I am well aware that data tables currently strips all table styling except the main table class. I have began trying a few different things and modifying the buttons.print.js file in order to achieve this.
var a = c.buttons.exportData(d.exportOptions),
k = function (b, a) {
for (var c = '<tr class="' + (this).className + '">', d = 0, e = b.length; d < e; d++) c += "<" + a + ">" + b[d] + "</" + a + ">";
return c + "</tr>"
},
This returns as undefined for the classes...has anyone had any luck out there...or have any tips or examples of what I am trying to achieve?
This question has an accepted answers - jump to answer
Answers
Here is the link to the complete buttons.print.js file I am working with: LINK
Myself and my colleague figured this out for anyone that would like to retain classes/styling for the tables when they are trying to print...
One thing to note is that this will only work correctly if one data table is on the screen...still working out a way to support multiple tables correctly...
This should do the trick:
Murgy you are a gentleman and a scholar
Also if you need to keep the table id when printing...