Reputation: 1536
Why my class
to add text-align
did not work on @media print
?
I made an EXAMPLE PLUNKER
I want that Right Element
stay on right when user clicks on Print
button
Style
@media print {
td.text-right-print {
text-align: right!important
}
}
Tabela
<table class="table" id="example">
<thead>
<tr>
<th>Left Thead</th>
<th>Right Thead</th>
</tr>
</thead>
<tbody>
<tr>
<td>Left Element</td>
<td align="right" class="text-right-print">Right Element</td>
</tr>
<tbody>
</table>
Thanks!
Upvotes: 1
Views: 1221
Reputation: 7663
You can use the customize
method of jquery datatable.
$(document).ready(function() {
$('#example').DataTable({
dom: 'Bfrtip',
buttons: [
{
extend: 'print',
customize: function ( win ) {
$(win.document.body).find('table tr td:nth-child(2)')
.addClass('rightAlign');
}
}
]
});
});
Please find the link below for more information:
Upvotes: 4