How to receive Cell-data in Grid?

Hello,

I am sorry if this is a fairly easy Question but I am lost right now, so I am Using Vaadin 8 and i have filled a
Grid with Information out of a Database. So far so good, my next Step is to allow changes in the grid (Inline editing) and make the changes save to the database.

I know how I have to setup the database and stuff…

but I do not know how to receive the values or text out of a selected cell…
So lets say we have a Class “Person” and Persons have variable “name”, also we have a column “Persons” and theres a “Frank” as item…

I use

grid.addItemClickListener(event -> notification.show("Value: " + defaultModel.getSelectedItem()) notification.show("Value: " + event.getItem()) ); to see the values of the selected Cells (or Rows) and it says : Person@154f7a47 instead of “Frank” and stuff like that, how do I have to continue to receive my actual content out of it?

My goal is to add an event → “WHEN cell is changed, get current Row+Column of the Cell and new Value(So I have an Index for my PersonList I used to fill the Grid), and change the Person on List[at Index we changed a Cell]
, then use the List to update data back to Database!”

I am not sure if it will work like that though…

I hope you understood, thank you guys.

The method “event.getItem()” returns reference to object of type Person (e.g. Person@154f7a47), so that is not “Frank”. Frank is probably name in Person, so you may have Person.getName(), that returns String like “Frank”. Thus you need to do something like follows (note that getter method name can be something else too)

Person person = (Person) event.getItem();
notifiction.show("Value: " + person.getName());