0

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?

Tatu Lund
  • 9,949
  • 1
  • 12
  • 26
benji__
  • 47
  • 3
  • 9

1 Answers1

2

I looked to your code and it seemed to be right, so I copied it to plain Vaadin 8 archetype, and it worked for me. I can see the Grid with right content enter image description here

Did you remember to recompile the widgetset?

Tatu Lund
  • 9,949
  • 1
  • 12
  • 26
  • I did not. Thank you! As a matter of fact I used to run the same "Run configuration" -> mvn compile jetty:run – benji__ Apr 21 '18 at 09:44
  • @benji__ Please mark this answer as correct answer if it solves your problem (green check mark on the left side of answer). – Steffen Harbich Apr 24 '18 at 07:35