Grid inline editor listener

Hi,

We are developing a com.vaadin.ui.Grid, populated by a BeanItemContainer. This Grid has inline editing capabilities activated.

We need to listen to any changes made by inline editing in this Grid. But I cannot figure out how to do this, or any relevant examples.

Please see the below sample code:

Grid grid = new Grid();
grid.setSelectionMode(SelectionMode.NONE);
grid.setSizeFull();
grid.setEditorEnabled(true);
grid.setEditorCancelCaption("Angre");
grid.setEditorSaveCaption("Lagre");
// How to add a listener to the editor??

BeanItemContainer<VariableItem> container = new BeanItemContainer<>(VariableItem.class);
GeneratedPropertyContainer gpc = new GeneratedPropertyContainer(container);
grid.setContainerDataSource(gpc);

Hi Erik,

the easiest way would be to create the suitable component (e.g. ComboBox, TextField and so on) and then set them as the corresponding Editor Field like so:

TextField nameEditor = new TextField();

// Custom CSS style
nameEditor.addStyleName("nameeditor");
// Custom validation
nameEditor.addValidator(new RegexpValidator( "^\\p{Alpha}+ \\p{Alpha}+$", "Need first and last name"));

// Add ValueChangeListener
nameEditor.addValueChangeListener(e -> {});

grid.getColumn("name").setEditorField(nameEditor);

The code is from the
Grid documentation
.