Different resolutions and browser-adaptive, the list does not appear scroll bar, the table content wrap.
Method: By defining the table column properties, combining the <TABLE>CSS style and the defined column cell style ' Td_huanhang '/' Td_unhuanhang '
"Columndefs": [
{targets:9, Orderable:false, Width: "10%"},
]
Columns: [
{"Data": "Addr", "name": "Addr", ClassName: "Td_unhuanhang",
Render:function (data, type, row, meta) {
if (data!=null) {
return type = = = ' Display ' && data.length > 10?
' <div title= ' ' +data+ ' > ' +data.substr (0) + ' ...</div> ': data;
Return ' <div title= ' +data+ ' > ' +data+ ' </div> ';
}
else{
Return ';
}
}
}
]
<table class= "Table table-striped table-bordered table-hover no-margin text-center" style= "table-layout:fixed;" >
</table>
After this operation, the table is fixed width, but the inside of the article if very long, the text will still run out
Workaround:
Add style= in TD "Word-wrap:break-word;" Wrap it up, if you don't want to wrap, you can set the out-of-content to hide and use ellipses instead
. td_huanhang{
/* Line Break */
Word-wrap:break-word;
}
. Td_unhuanhang > div{
/* No line break, ellipsis instead of */
// the text does not wrap, and the text continues on the same line until the <br> tag is encountered.
Overflow:hidden;
//...
}
From for notes (Wiz)
DataTables defining the self-adapting method of column widths