Bootstrap 4 引导数据表打印第二次不起作用 $(文档).ready(函数(){ var printCounter=0; //在初始化DataTables之前,将标题附加到表中 $(“#示例”).append('虚构公司的员工表'); $('#示例')。数据表({ dom:'Bfrtip', 按钮:[ “复制”, { 扩展:“excel”, messageTop:“此表中的信息版权归天狼星控制论公司所有。” }, { 扩展:“pdf”, messageBottom:null }, { 扩展:“打印”, messageTop:function(){ printCounter++; 如果(打印计数器===1){ return“这是您第一次打印此文档”; }否则{ 返回“您已打印此文档”+打印计数器+“次数”; } }, messageBottom:null } ] }); });

Bootstrap 4 引导数据表打印第二次不起作用 $(文档).ready(函数(){ var printCounter=0; //在初始化DataTables之前,将标题附加到表中 $(“#示例”).append('虚构公司的员工表'); $('#示例')。数据表({ dom:'Bfrtip', 按钮:[ “复制”, { 扩展:“excel”, messageTop:“此表中的信息版权归天狼星控制论公司所有。” }, { 扩展:“pdf”, messageBottom:null }, { 扩展:“打印”, messageTop:function(){ printCounter++; 如果(打印计数器===1){ return“这是您第一次打印此文档”; }否则{ 返回“您已打印此文档”+打印计数器+“次数”; } }, messageBottom:null } ] }); });,bootstrap-4,Bootstrap 4,我正在我的应用程序中使用下面的链接数据表 当我第一次单击打印时,它工作正常并进入打印页面,但当我第二次或第三次单击时,它不会打印 您可以在下面的链接中检查相同的问题 我也有同样的问题,你在Chrome上测试过吗?? $(document).ready(function() { var printCounter = 0; // Append a caption to the table before the DataTables initialisation $('#ex

我正在我的应用程序中使用下面的链接数据表

当我第一次单击打印时,它工作正常并进入打印页面,但当我第二次或第三次单击时,它不会打印

您可以在下面的链接中检查相同的问题


我也有同样的问题,你在Chrome上测试过吗??
$(document).ready(function() {
    var printCounter = 0;

    // Append a caption to the table before the DataTables initialisation
    $('#example').append('<caption style="caption-side: bottom">A fictional company\'s staff table.</caption>');

    $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'copy',
            {
                extend: 'excel',
                messageTop: 'The information in this table is copyright to Sirius Cybernetics Corp.'
            },
            {
                extend: 'pdf',
                messageBottom: null
            },
            {
                extend: 'print',
                messageTop: function() {
                    printCounter++;

                    if (printCounter === 1) {
                        return 'This is the first time you have printed this document.';
                    } else {
                        return 'You have printed this document '+printCounter+' times';
                    }
                },
                messageBottom: null
            }
        ]
    });
});