数据表中的@Media 打印类

约翰逊

为什么我class的添加text-align不起作用@media print

我做了一个示例 PLUNKER

我希望Right Element当用户点击Print按钮时保持正确

风格

@media print {
  td.text-right-print {
    text-align: right!important
  }
}

桌子

  <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>

谢谢!

拉胡尔

可以使用customizejquery数据表方法。

$(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');
                }
            }
        ]
      });
    });

示例 Plunker

请找到以下链接以获取更多信息:

数据表打印定制

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章