Items in a listing Examples

In the doc Data model / Showing many Items in a Listing there is an example that it uses a grid to show a list of person and try to short with comparator the column of name.

grid.addColumn("Name", Person::getName) .setComparator(Comparator.comparing( person -> person.getName().toLowerCase())); When i try do it the same Eclipse indicate an error about the method addColumn but i don’t know exactly why.
Eclipse says that the methos is not applicable for those arguments.
In the API it is

public Grid.Column<T,?> addColumn(String propertyName, AbstractRenderer<? super T,?> renderer)

which version of Vaadin are you using?

Seems the document is a bit outdated. Instead, you can use


This is the link of the official documentation of Vaadin Framework 8

grid.addColumn("Name", Person::getName) // Override default natural sorting .setComparator(Comparator.comparing( person -> person.getName().toLowerCase())); I use Vaadin 8.1.6 and the method that you mention in your message isn’t in the API.

return a Grid.column<V,T> class
This class has not addComparator method but also setCompator

The problem is Comparator that is not SerializableComparator that needs setComparator.

Sorry, now I see the real problem. Yes, it’s a bug, related to this issue
so to create a SerializableComparator, you need to add ::compare.
The document in is wrong, should be updated.