I am curious if there is a way to set one of the columns to 'absorb' any extra width. For instance, I want all the columns to have auto width to the smallest possible width that the data within allows (without text wrapping) and I want one column to expand to whatever width is necessary to fill the table to 100%.
Or if anyone knows how, to set the table width to automatically only take up the necessary width.
How to fix column width in DataTable? The columns that are fixed in place by FixedColumns take their width from the parent DataTable. As such, the width of the column can be controlled using the columns. width option.
Set to 'fixed' for columns with equal widths. Set to 'auto' for column widths that are based on the width of the column content and the table width. The default is 'fixed'. Array of the columns object that's used to define the data types.
http://jsfiddle.net/pxfunc/gFa29/
table {width:100%;border:solid 2px #ddd;}
th, td {white-space:nowrap;border:solid 1px #eee;}
.fill {width:95%}
nowrap
td
or th
cells to a high % width to absorb the extra spaceIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With