grid column initialisation

Hi all
grid initialisation requires column binding such as

grid.setItems(myClassService.getItemList());
grid.addColumn(MyClass::getId).setCaption("id");
...

Evidently, this leads to an error “non-static method cannot be referenced from static context”

I understand that I cannot call non static method from non instantiated object, but how properly bind columns ?

Thanks

Your code snippet looks ok to me, so there’s something else that’s causing this error. Did you take a look at the [Grid docs]
(https://vaadin.com/docs/v8/framework/components/components-grid.html) already?

-Olli