jQuery DataTables: control table width

后端 未结 26 2282
别那么骄傲
别那么骄傲 2020-11-29 16:29

I have a problem controlling the width of a table using the jQuery DataTables plugin. The table is supposed to be 100% of the container width, but ends up being an arbitrar

26条回答
  •  星月不相逢
    2020-11-29 17:23

    You have to leave at least one field without fixed field, for example:

    $('.data-table').dataTable ({
    
     "bAutoWidth": false,
     "aoColumns" : [
        null,
        null,
        null,                    
        null,
        {"sWidth": "20px"},
        { "sWidth": "20px"}]
    });
    

    You can change all, but leave only one as null, so it can stretch. If you put widths on ALL it will not work. Hope I helped somebody today!

提交回复
热议问题