dataTable 怎么控制tr宽度,如何设置

g_simpool_vom_table = $('#' + simpool_vom_table_id).DataTable({
        "language": {
            "lengthMenu": "每页 _MENU_",
            "zeroRecords": "没有找到记录",
            "info": "第 _PAGE_ 页 (总共 _PAGES_ 页 )",
            "infoEmpty": "无记录",
            "infoFiltered": "(从 _MAX_ 条记录过滤)",
            "sSearch": "搜索",
            "oPaginate": {
                "sFirst": "第一页",
                "sPrevious": " 上一页 ",
                "sNext": " 下一页 ",
                "sLast": " 最后一页 "
            }
        },
        "destroy": true,
        "paging": true,
        "pagingType": "simple_numbers", // simple, numbers, simple_numbers, full, full_numbers, first_last_numbers
        "lengthMenu": [5, 10, 20, 50, 100],
        "pageLength": 10,
        "lengthChange": true,
        "searching": true,
        "ordering": true,
        "info": true,
        "select": 'single',
        "autoWidth": true,
        "deferRender": true, // 延迟渲染,加速界面加载.
        "fixedHeader": true,
        "scrollX": false,
        "scrollY": false,
        "scrollCollapse": true,
        "stripeClasses": ['odd', 'even'],
        "dom": '<"row"<"col-lg-1"<"toolbar">><"col-lg-4"B><"col-lg-7"f>>t<"row"<"col-lg-2"l><"col-lg-3"i><"col-lg-7"p>>',
        //          "dom": '<"row"<"col-lg-4"B><"col-lg-8"f>>t<"row"<"col-lg-2"l><"col-lg-3"i><"col-lg-7"p>>', 
        "buttons": {
            // 'copy', 'csv', 'excel', 'pdf', 'print'
            "buttons": [{
                    extend: 'copy',
                    text: '<i class="fa fa-qrcode"></i>',
                    className: 'btn btn-warning btn-flat'
                },
                {
                    extend: 'csv',
                    text: '<i class="fa fa-file-excel-o"></i>',
                    className: 'btn btn-warning btn-flat',
                    title: 'Mote Lists-' + new Date()
                },
                {
                    extend: 'print',
                    text: '<i class="fa fa-print"></i>',
                    className: 'btn btn-warning btn-flat',
                    title: 'Mote Lists-' + new Date()
                }
            ]
        },
        "aoColumns": columnDefines,
        "ajax": {
            url: ajaxUrl,
            data: ajaxPara,
            dataType: 'json',
            type: "POST",
            dataSrc: '' //""=[],即普通Arr,  datarow:{"datarow": []} 
        }
    });
    //toolbar
    $("#simpool_vom_table_pdiv div.toolbar").html(getSimPoolVomTabToolBar());
    //创建
    $("#btn_flow_add").unbind("click");
    $("#btn_flow_add").on("click", function() {
        btn_flow_add_click();
    });

情况如图
图片描述

阅读 6.1k
1 个回答

tr宽度?td的宽度吧?
两个配置项:

$('#example').dataTable( {
  "autoWidth": false,
  "columns": [
    { "width": "20%" },
    null,
    null,
    null,
    null,
    null
  ]
} );

参考API:autowidthcolumns.width

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题