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.
Adding scrollbar to table when individual row height changes
Hi,
I am struggling with following problem. I have a table where rows contains VerticalLayouts. In these layouts components may be added which means that row height increases. When combined row heights exceeds table height --> lowest rows are not seen in the table anymore and scrollbar is not shown. Is there any way to add scrollbar to the table when adding components to layout?
I attached sample code which demonstrates my problem. When Add -button is pressed few times lowest rows are not shown in the table and no scrollbar is shown.
protected void init(VaadinRequest vaadinRequest) {
final LayoutBeanItem beanItem = new LayoutBeanItem();
final LayoutBeanItem beanItem1 = new LayoutBeanItem();
final LayoutBeanItem beanItem2 = new LayoutBeanItem();
final LayoutBeanItem beanItem3 = new LayoutBeanItem();
BeanItemContainer beanItemContainer = new BeanItemContainer(LayoutBeanItem.class);
beanItemContainer.addBean(beanItem1);
beanItemContainer.addBean(beanItem);
beanItemContainer.addBean(beanItem2);
beanItemContainer.addBean(beanItem3);
final Table table = new Table();
table.setWidth("500px");
table.setHeight("200px");
table.setContainerDataSource(beanItemContainer);
table.setVisibleColumns(new Object{"layout"});
table.setSelectable(true);
Button addButton = new Button("Add");
VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.addComponent(addButton);
verticalLayout.addComponent(table);
setContent(verticalLayout);
addButton.addClickListener(new Button.ClickListener() {
@Override
public void buttonClick(Button.ClickEvent event) {
beanItem.getLayout().addComponent(new Label("new text"));
}
});
}
public class LayoutBeanItem
{
VerticalLayout layout = new VerticalLayout();
public LayoutBeanItem()
{
layout.addComponent(new Label("text"));
}
public VerticalLayout getLayout() {
return layout;
}
public void setLayout(VerticalLayout layout) {
this.layout = layout;
}
}