Datatables 数据表页脚不包括在数据表打印导出选项中

Datatables 数据表页脚不包括在数据表打印导出选项中,datatables,Datatables,我正在使用Codeigniter和带有DataTable的ajax请求来获取数据,并尝试使用DataTable打印导出选项打印数据。但页脚没有出现在打印中 如何在使用DataTable打印时包含页脚 这是我的密码: function data_table_report(dateselected){ $("#dataTables-report").dataTable().fnDestroy(); table = $('#dataTables-report').DataTable(

我正在使用Codeigniter和带有DataTable的ajax请求来获取数据,并尝试使用DataTable打印导出选项打印数据。但页脚没有出现在打印中

如何在使用DataTable打印时包含页脚

这是我的密码:

function data_table_report(dateselected){
    $("#dataTables-report").dataTable().fnDestroy();
    table =  $('#dataTables-report').DataTable({
        "ajax": {
        "url": "<?php echo site_url('patients_report/dataTable_report/')?>"+dateselected,
        "type": "POST",
        },
        responsive: true,
        bInfo: false,
        dom: 'Bfrtip',
        buttons: [{ extend: 'print',
            exportOptions: {
                columns: ':visible'
                 }
        },
        'colvis'],
        columnDefs: [ { 
            targets: -1,
            visible: false} 
       ]
   });
}
function data\u table\u报告(dateselected){
$(“#dataTables报告”).dataTable().fnDestroy();
表=$(“#数据表报告”)。数据表({
“ajax”:{
“url”:“+dateselected”,
“类型”:“职位”,
},
回答:是的,
宾福:错,
dom:'Bfrtip',
按钮:[{扩展:“打印”,
出口选择:{
列:“:可见”
}
},
“colvis”],
columnDefs:[{
目标:-1,
可见:false}
]
});
}

添加页脚属性,如下所示

buttons: [{ extend: 'print',
            footer: true,
            exportOptions: {
                columns: ':visible'
                 }
         }]

添加页脚属性,如下所示

buttons: [{ extend: 'print',
            footer: true,
            exportOptions: {
                columns: ':visible'
                 }
         }]
试试这个:

"fnInitComplete": function (oSettings, json) {          
    myfooter = this.find('tfoot')[0].innerHTML;
    new $.fn.dataTable.Buttons( this, {
    buttons: [          
         {
            extend: 'print',
            exportOptions : {
                columns: ':not(.notForPrint)'
            },
            customize: function ( win ) {
                $(win.document.body)
                    .css( 'font-size','10pt') 
                    .css( 'font-family','arial'); 
                $(win.document.body).find( 'table' )
                    .addClass( 'compact' )
                    .css( 'font-size', 'inherit' );
                $(win.document.body).find('tfoot')[0].innerHTML = myfooter ;
                win.print();
                setTimeout(win.close(),500);
            }
        }
    ]
    });
    this.DataTable().buttons().container().insertBefore( '#example_filter');  
},请尝试以下方法:

"fnInitComplete": function (oSettings, json) {          
    myfooter = this.find('tfoot')[0].innerHTML;
    new $.fn.dataTable.Buttons( this, {
    buttons: [          
         {
            extend: 'print',
            exportOptions : {
                columns: ':not(.notForPrint)'
            },
            customize: function ( win ) {
                $(win.document.body)
                    .css( 'font-size','10pt') 
                    .css( 'font-family','arial'); 
                $(win.document.body).find( 'table' )
                    .addClass( 'compact' )
                    .css( 'font-size', 'inherit' );
                $(win.document.body).find('tfoot')[0].innerHTML = myfooter ;
                win.print();
                setTimeout(win.close(),500);
            }
        }
    ]
    });
    this.DataTable().buttons().container().insertBefore( '#example_filter');  
},添加以下内容:

buttons: [{ extend: 'print', footer: true }]
添加以下内容:

buttons: [{ extend: 'print', footer: true }]

添加一些说明添加一些说明