【问题标题】:PDF does not show complete with datatable buttonPDF 未显示完整的数据表按钮
【发布时间】:2020-09-14 20:50:19
【问题描述】:

我正在尝试可视化几乎所有数据表列的 pdf,但是,pdf 文档没有显示最后两列。说了这么多,我有两个问题。首先如何使“Opciones”列不出现,第二个是如何使 pdf 显示完整?我将不胜感激任何帮助。谢谢

这是我的代码:

function listar() {
    tabla = $('#tbllistado').dataTable({
        "aProcessing": true,//activamos el procedimiento del datatable
        "aServerSide": true,//paginacion y filrado realizados por el server
        dom: 'Bfrtip',//definimos los elementos del control de la tabla
        buttons: [
            'copyHtml5',
            'excelHtml5',
            'csvHtml5',
            'pdf'
        ],
        "ajax":
        {
            url: '../ajax/venta.php?op=listar',
            type: "get",
            dataType: "json",
            error: function (e) {
                console.log(e.responseText);
            }
        },
        "bDestroy": true,
        "iDisplayLength": 5,//paginacion
        "order": [[0, "desc"]]//ordenar (columna, orden)
    }).DataTable();
}

和结果的图像 enter image description here

这也是pdf enter image description here

【问题讨论】:

    标签: javascript php datatable datatables


    【解决方案1】:

    我自己弄明白了,我所要做的就是给pdf按钮添加一些参数。非常感谢

    buttons: [
                'copyHtml5',
                'excelHtml5',
                'csvHtml5',
                {
                    extend: 'pdf',
                    orientation: 'landscape',
                    exportOptions: {
                        columns: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ]
                    }
                }
            ]
    

    【讨论】:

      猜你喜欢
      • 2019-04-23
      • 2017-07-31
      • 2022-01-25
      • 1970-01-01
      • 2021-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多