Recently I upgraded Vaadin version for 7 to 8.3.2. One of the changes introduced in newer version is that setContainerDataSource method is deprecated. So I changed my code to:
List<Person> people = Arrays.asList(
new Person("Nicolaus Copernicus", 1543),
new Person("Galileo Galilei", 1564),
new Person("Johannes Kepler", 1571));
// Create a grid bound to the list
Grid<Person> grid = new Grid<>();
grid.setItems(people);
grid.addColumn(Person::getName).setCaption("Name");
grid.addColumn(Person::getBirthyear).setCaption("Year of birth");
Here's Person class implementation:
public class Person implements Serializable {
public Person(String name, int birthyear) {
this.name = name;
this.birthyear = birthyear;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getBirthyear() {
return birthyear;
}
public void setBirthyear(int birthyear) {
this.birthyear = birthyear;
}
private String name;
private int birthyear;
}
Gird is part of HorizontalLayout which is in VerticalLayout. Unfortunately, in the browser I can see only the border of the table - with no values in it. How can it be so? Am I missing something?