Reputation: 159
I have a grid with one column named "Object". I have one row/item under the column with the value of "Location". When I try to get the string value of the row, I get an int value of 1. I need the string value of the row which is "Location", not the number of the row:
queryLabel1.setValue(grid.getSelectedRow().toString());
How can I get the string value of this row when it is selected and put the value in a Label?
Upvotes: 1
Views: 6254
Reputation: 159
Found my answer in Vaadin forums: https://vaadin.com/forum#!/thread/14343801
This made it work for me:
Object selected = ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow();
grid.getContainerDataSource().getItem(selected).getItemProperty("Object")).getValue();
Upvotes: 1