Print Button Columns Words Stacking
Print Button Columns Words Stacking
I'm using the DataTables Print Button and I am having trouble getting both of the columns to print the same. I use the same button setup for both grids that I print, but one grid will leave the Column header as-is, and the other will stack them.
For example, instead of the column saying "First Middle," it will be "First\nMiddle."
buttons: [
{
extend: 'print',
className: 'printButtonDetailOnly',
exportOptions: {
columns: ':visible',
},
title: 'I stack, sad face'
customize: function (win) {
$(win.document.body)
.css('font-size', '18pt');
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
},
}
]
which leaves me with a stacked column
That, compared to the other print button:
buttons: [
{
extend: 'print',
exportOptions: {
columns: ':visible'
},
title: 'I do not stack! Yay!',
customize: function (win) {
$(win.document.body)
.css('font-size', '18pt');
$(win.document.body).find('table')
.addClass('compact')
.css('font-size', 'inherit');
},
}
]
which provides an un-stacked column
I've been kicking this around for a few days, looking into all the properties for the print button, but nothing seems to control this.un-stacked column
This question has an accepted answers - jump to answer
Answers
Without seeing how you defined the tables my guess is one table has the class of "nowrap" and the other does not.
Kevin
Also, we have no idea what your 'printButtonDetailOnly' class is doing.
Thanks Kevin. That's exactly what it was.