Component can't save data

Hi everyone, my problem is simple yet it is quite difficult for me. I am trying to create a view in which there are images shown in 4 columns and x rows. My logic was to create a big VerticalLayout with HorizontalLayouts inside. The problem is when I try to call a removeAll() function on the HorizontalLayout(). It removes also the content from the VerticalLayout. I’ve tried to do smth like “div.addAndExpand(new HorizontalLayout(row))” but it seems that also doesn’t work.
18508553.png

You need to create a new HorizontalLayout instance for each row, now you are not. Thus it is not working.

Ok, I’ve tried something like this div.addAndExpand(new HorizontalLayout(row)); but that also didn’t work.