How to fit all columns in a grid ?


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 ?

I would try playing with setMinimunWidth() and setMaximumWidth().

Unfortunately, even if I set the minimum width to a very small value (let say 50px), the column width adjust to content. :frowning:

Yes, this is a known limitation. Mentioned in this issue:
and maybe others too.