Adding empty rows not rendering

Probably this is an easy question but I can’t find an answer.

I have my table style as striped. There I noticed big blocks of rows with the same color. Looking at the code I noticed that I was adding empty rows, (or attempting to) by using:

addItem(new Object[]{"", ""}, i++);

There I noticed that there should be an empty row after each colored row but is not rendered. This is the way I used to do it on Swing application I’m porting over. Any ideas?

You could try a space or a non-breaking space (\u00a0) instead of an empty string.

I already tried with a space with the same result. I’ll try the non-breaking space next.

Using the non-breaking space (\u00a0) did the trick. Thanks!

Hi,

I am new to Vaadin. I have the probably simple question that I am trying to add an empty row to a GridLayout. But I don’t know how to do it.
Please help.

Thanks.

Hi Debasish,

one way would be to add a

new Label(" ", ContentMode.HTML); on the row.

-Olli

Hi Olli,

I tried as below

GridLayout grid = new GridLayout(5, 20); ... grid.addComponent(new Label(" ", ContentMode.HTML)); ... but it didn’t work.
Thank you for your response.

Ah, sorry, a formatting mistake; try “&nbsp” instead of " ".