Hello, i have the following requirement:
I want to have a 3 column layout, where the columns might contain a different amount of components.
All columns should have the length of the longest column in the end, even if containing fewer items.
The columns will have a given background color.
The container wrapping the columns should be scrollable to allow to scroll down the columns.
First aproach:
Nesting VerticalLayouts inside a HorizontalLayout.
Add overflow-y
to the HorizontalLayout.
Example (using only 1 column):
@Theme(value = Lumo.class, variant = Lumo.DARK)
@HtmlImport("frontend://styles/shared-styles.html")
@Route
@PWA(name = "Project Base for Vaadin Flow with Spring", shortName = "Project Base")
public class Main extends HorizontalLayout {
public Main() {
setSizeFull();
getElement().getStyle().set("overflow-y", "auto");
VerticalLayout layout = new VerticalLayout();
layout.getStyle().set("background", "var(--lumo-shade-10pct)");
add(layout);
IntStream.rangeClosed(0, 100).forEach(i -> layout.add(new H1(String.valueOf(i))));
}
}
Result:
![Result]
(https://vaadin.com/attachment/9c3ba02d-3af7-45f9-9f0a-10a4e4b707da/Capture.PNG)
As you can see, the nested VerticalLayout does not grow with its content causing the background to be cut off.
Is this the wrong approach or what is wrong here?