Column width exactly equal to content.
Column width exactly equal to content.
Hello!
I have an example table: http://live.datatables.net/piqukeje/5668/ (edit link for convenience: http://live.datatables.net/piqukeje/5668/edit )
I would like for the second column to be exactly the width of the largest content item (which may actually be the table header name "position").
Image to illustrate: https://imgur.com/a/vZlVNto - imagine (something) is added so that the column is exactly the width of the largest content item; the largest content item is not known as the tables data is dynamic so it must be calculated when rendered in the browser. All other columns using auto-width is desirable. I can't figure out what (something) may be!
What might (something) be?
Thank you!
This question has an accepted answers - jump to answer
Answers
Maybe you can set a small
columns.width
for the column. Also set the classnowrap
on thetable
tag. I think the width will be adjusted to the longest content even with a small width setting. Something like this:http://live.datatables.net/vakiratu/1/edit
Kevin
@kthorngren Works for me! Thank you.