0

I am trying to display a Vaadin component, a grid with Vaadin 10 on my page.

It is there in the DOM but not visible on the Page.

My class is:

@Route("")
@Log
public class ProfileList extends VerticalLayout {     
    public ProfileList(PersonRepository repo) {
        Grid<Profile> grid = new Grid<>();
        grid.addColumn(Person::getName).setHeader("Name");         
        grid.setItems(profilerepo.findAll());
        add(grid);    
    }   
}
thi gg
  • 1,969
  • 2
  • 22
  • 47

1 Answers1

1

The problem is, that the VerticalLayout is not increasing its size to fit the grid.

Because the grid is below the visible area of the VerticalLayout, it is hidden.

A simple fix would be to use:

setSizeFull();

Which tells the VerticalLayout to span the page.

thi gg
  • 1,969
  • 2
  • 22
  • 47