Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to fit all columns in a grid ?
Hi,
Vaadin 7.7.7
Let say I have a grid with columns A,B,C,D,E and that is setSizeFull(). The "B" column contains description that is not much important. I wish to have all my columns displayed in the viewport (i.e.: no horizontal scrolling) by shrinking content of column B if needed.
I can play with setExpandRatio() on the columns but it seems that there is NO way to tell to shrink content if needed.
JavaDoc of setExpandRatio()
A grid with three columns, with expand ratios 0, 1 and 2, respectively. The column with a ratio of 0 is exactly as wide as its contents requires. The column with a ratio of 1 is as wide as it needs, plus a third of any excess space, because we have 3 parts total, and this column reserves only one of those. The column with a ratio of 2, is as wide as it needs to be, plus two thirds of the excess width.
Any idea ?
Thanks
Stephen
I would try playing with setMinimunWidth() and setMaximumWidth().
https://vaadin.com/api/8.0.0/com/vaadin/ui/Grid.Column.html
Tatu Lund: I would try playing with setMinimunWidth() and setMaximumWidth().
https://vaadin.com/api/8.0.0/com/vaadin/ui/Grid.Column.html
Unfortunately, even if I set the minimum width to a very small value (let say 50px), the column width adjust to content. :-(
Yes, this is a known limitation. Mentioned in this issue: https://github.com/vaadin/framework/issues/8548 and maybe others too.