Search code examples
vaadinvaadin8vaadin-grid

Vaadin 8 Grid display related item name


Trying to get the related items name to display within a Vaadin Grid.

This will get the name of the main item:

grid.addColumn(thing::getName).setCaption("Name"); 

This will return the object of the related item:

grid.addColumn(thing::getRelatedThing).setCaption("Related Thing Name"); 

Solution

  • The answer is fairly simple. Placing here in case it might help others or maybe someone has a better way.

    grid.addColumn(e -> e.getRelatedThing.getName).setCaption("Related Thing Name");