I was able to right align my print layout, how do I apply that to individual columns?
I was able to right align my print layout, how do I apply that to individual columns?
hm123
Posts: 84Questions: 27Answers: 1
I used customize to modify the print layout. This applies to the whole table. How do I apply this to individual columns?
My current code:
customize: function (win){
$(win.document.body).find('table').css('text-align', 'right');
},
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
First I tried this and it did not seem to work:
Setting classes for the columns in JavaScript using columnDefs, and then subsequently styling those classes in CSS only affected the html table render itself, the CSS was not carried over to the print layout.
However I was able to find a solution to this.
By using this script code within the customize option of print:
Where each column would be set with the nth child.
Or alternatively use this pure CSS method:
The pure CSS method appears to work okay: https://jsfiddle.net/6724x3LL/4/ .
Interestingly it appears that the classes from
columns.className
are not carried over to the print table. I think that's wrong and I'll get that corrected.Thanks,
Allan
Fix committed here and will be in the next release.
Allan