How to set maximum width for a specific column in jQuery DataTables

How to set the maximum width for one specific column, all other columns should be automatically set. I tried the code below, but it does not work, as I think the max-width attribute is missing

$('#table').dataTable({ 'paging': false, 'info': false, 'searching': false, 'columnDefs': [ {'max-width': '320px', 'targets': 'my-column'} ], }); 
+1
jquery datatable
source share
1 answer

Try something like this

max-width specify percentage of width

target option specify field index

 $('#table').dataTable({ 'paging': false, 'info': false, 'searching': false, 'columnDefs': [ {'max-width': '20%', 'targets': 0} ], }); 
+1
source share

All Articles