【问题标题】:Jquery Datatables responsive not working properlyJquery Datatables响应不正常
【发布时间】:2018-02-01 17:40:13
【问题描述】:

我正在使用带有响应式插件的数据表,

https://cdn.datatables.net/responsive/2.1.1/css/responsive.dataTables.css
https://cdn.datatables.net/responsive/2.1.1/js/dataTables.responsive.js

这是我的屏幕结果:

桌面视图:

移动视图顶部:

移动端视图底部:

我的 JS 代码:

    dataTable = $('#agency_data').DataTable({
    "processing":true,
    "serverSide":true,
    "order":[],
    responsive: true,

    "language": {
    "infoFiltered": ""
    },
    "ajax":{
        url:base_url+"/agency-listing",
        type:"POST"
    },
    "columnDefs":[
        {
            "targets":[0, 3], //first and last not sortable
            "orderable":false,
        },          
    ],

}); 

我的表格的 HTML:

        <table id="agency_data" class="table table-bordered table-striped">
        <thead>
        <tr class="info">
        <th width="10%">ID</th>
        <th width="15%">Agency Code</th>
        <th width="65%">Agency Name</th>
        <th width="15%">Action</th>
        </tr>
        </thead>
        </table>

JSFIDDLE: HERE

问题:

1) 在移动端,如何获取Long组织名称,完美显示?喜欢BR?

2) 如何去掉底部的水平滚动,让用户无需在移动视图上滚动?

【问题讨论】:

    标签: jquery datatable datatables


    【解决方案1】:

    在表格中添加:width="100%" 解决了问题

    <table id="agency_data" class="table table-bordered table-striped" width="100%">
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-14
    • 2021-01-20
    • 1970-01-01
    • 2011-02-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多