xxxxxxxxxx
$('#table_selector').dataTable( {
"autoWidth": false, //<-------- add this
//give custom width
"columns": [
{ "width": "10%" },
} );
xxxxxxxxxx
$('#example').dataTable( {
"autoWidth": false, // might need this
"columns": [
{ "width": "20%" },
null, // automatically calculates
null // remaining width
]
} );
xxxxxxxxxx
Javascript
1
2
3
4
5
$('#example').dataTable( {
"columnDefs": [
{ "width": "20%", "targets": 0 }
]
} );
xxxxxxxxxx
var table = $('#example').DataTable();
$('#container').css( 'display', 'block' );
table.columns.adjust().draw();
xxxxxxxxxx
table.display {
margin: 0 auto;
width: 100%;
clear: both;
border-collapse: collapse;
table-layout: fixed; // add this
word-wrap:break-word; // add this
}