GridLayout and SetSizeFull

I want to set the background color of a gridlayout cell. The cell will contain a simple string. To do this, I created a horizontal layout and set its size to full. I placed a label within the layout and added a style to the layout. I then added the layout to the gridlayout. Unfortunately, the horizontal layout does not fill the entire cell. The background color only fills the part of the cell containing the text.

Here is the code:

HorizontalLayout labelLayout = new HorizontalLayout();

Label label = new Label("foo");
gridLayout.addComponent(labelLayout, 2, 3);

From the documentation, I thought I only needed to set the labelLayout’s size to full and that would do it. I also tried setting the label’s size to full and that did not work either.

What do I need to do?


Solved my layout problem by using a Custom layout instead of the Grid Layout.

The FastGrid class in the
add-on would also copy the style from the contents to the cell, allowing such things. It has not been updated in a long time, though, so I’m not sure if the add-on works with the latest Vaadin versions without modifications.

Did someone solve that issue ?

I am solving it.

There is a chapter in Book of Vaadin about it

That did not help me.

I think there is no way how to set a background color for one row in GridLayout. :mad:
Maybe those FastLayouts. But FastGrid lacks lot of GridLayout functionality.