数据表列不会自动调整大小.这是我的代码
var oTable =$('#test').dataTable( {
"bJQueryUI": true,
"aaData": aDataSet,
"sPaginationType": "full_numbers",
"oTableTools": {
"aButtons": [ {"sExtends": "csv" , "sButtonText": "Save as CSV"}],
"sSwfPath": "js/jquery/copy_csv_xls.swf"
},
"bAutoWidth" : true,
"sDom": '<"H"lCf>t"H"<"F"iTp>',
"aoColumnDefs": [
{ "bVisible": true, "aTargets": [ 11 ] }
],
"aoColumns": [
{ "sTitle": "column1" },
{ "sTitle": "column1" },
{ "sTitle": "column1" },
{ "sTitle": "column1"},
{ "sTitle": "column1"},
{ "sTitle": "column1" },
{ "sTitle": "column1" },
{ "sTitle": "column1" },
{ "sTitle": "column1"},
{ "sTitle": "column1 By"},
{ "sTitle": "column1 Date"}
]
} );
oTable.fnAdjustColumnSizing();
});
Run Code Online (Sandbox Code Playgroud)
我希望所有列都至少根据其标头值自动调整大小.
dav*_*rad 18
你只是这样做,如果它是"正常" <table>:
th, td {
white-space: nowrap;
}
Run Code Online (Sandbox Code Playgroud)
看到fidle - > http://jsfiddle.net/YrWG5/带有一些极长的标题/内容.