JimmyJammed
JimmyJammed

Reputation: 9698

JQuery DataTables - Set one column to take extra width

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.

Upvotes: 5

Views: 2422

Answers (1)

MikeM
MikeM

Reputation: 27405

http://jsfiddle.net/pxfunc/gFa29/

table {width:100%;border:solid 2px #ddd;}
th, td {white-space:nowrap;border:solid 1px #eee;}
.fill {width:95%}
  • set the table to 100% width
  • set all cells to nowrap
  • set one of the td or th cells to a high % width to absorb the extra space

Upvotes: 5

Related Questions