Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 1 month ago
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);
Last updated on
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.
Last updated on
You cannot reply to this thread.