Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vaadin table with column widths according to the content width

Tags:

width

vaadin

In Vaadin, a HorizontalLayout gives each component exactly the space it needs as long as there is enough of it and not more.

In a table created with a BeanItemContainer however, all the columns have the same width. Because the table content is loaded dynamically, the width is different each time and different PCs have different font sizes, we don't want to specify a fixed width in pixels.

How can we tell the row to behave like a html table or a HorizontalLayout in that it gives each row the right width, not more and not less?

like image 255
Konrad Höffner Avatar asked Oct 14 '25 05:10

Konrad Höffner


1 Answers

setColumnWidth(-1) should activate auto-scaling. Though this is usually the default (even with BeanItemContainers, so I'm surprised you aren't seeing that behaviour automatically. A related concept, possibly worth you pursuing is setSizeUndefined() which is a method of the Sizeable interface.

like image 135
Dan Avatar answered Oct 17 '25 07:10

Dan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!