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