首页 > 解决方案 > 当我在数据表中添加按钮(打印)时,lengthChange 不显示

问题描述

我遇到了如何同时显示lengthChangeprint按钮的问题。

这是我的代码:

$(document).ready(function () {
    $('.table-driver').DataTable({
        "processing": true,
        "serverSide": true,
        "autoWidth": false,
        "ajax": "{{route('users.show')}}",
        "columns": [ 
            { "data": "name", name: "name" },
            { "data": "rate", rate: "rate" },
            { "data": "age", age: "age" },
            { "data": "status", status: "status" },
            {"data":"action", action: "action", sort: false}
        ], 
        dom: 'Bfrtip',
        buttons: [
            'print'
        ] 
    });
}); 

这是输出:在此处输入图像描述

想要的输出: 在此处输入图像描述

数据表的初学者,请有人可以帮助我。谢谢你。先生们。

标签: javascriptjquerydatatables

解决方案


我遇到了这个,我添加l到 dom 元素

像这样

dom: 'Blfrtip',

注意区别

'Bfrtip' 和 'Blfrtip'

希望它可以帮助某人


推荐阅读