I am struggling to close de mini-editor programmatically. I have tried some of the built-in functions from Grid:
Grid.saveEditor()
Grid.cancelEditor()
but none of them close the minieditor.
I have also call this function:
getEditorRpc().confirmSave(success, errorMessage, errorColumnIds)
Does Grid editor behaves like that by default, is it a bug or should Grid implements some function to close the mini-editor through Grid.saveEditor() and Grid.cancelEditor() functions?
I recently install the last version available (7.5.0). I took a look to issue (#18287) and that is not my case.
I haven’t made any modification in the Vaadin Grid component.
My problem is that I can’t close the mini-editor of an editing row programmatically from Java. Below I try to explain my Vaadin use case.
In the Grid, when an user finish of editing a row, my program has the option to catch ENTER key and then the mini-editor of the actual row should be saved and closed.
I have implemented a ShortcutListener to catch the ENTER key and inside this listener some code to save and close the mini-editor (with no success). I have tried both the Grid.saveEditor and Grid.cancelEditor() but none of them closed the mini-editor.
Steps to reproduce:
Add shortcutListener ENTER to the Grid.
Inside the ENTER Listener, execute function Grid.saveEditor()
Run the program, doubleclick to edit a row, and press ENTER.
The mini-editor should be deactived, but it is still actived
Just made a quick test with 7.5.0 using the following ShortcutListener and everything seems to work:
grid.addShortcutListener(new ShortcutListener("Save", KeyCode.ENTER, null) {
@Override
public void handleAction(Object sender, Object target) {
if (grid.isEditorActive()) {
try {
grid.saveEditor();
grid.cancelEditor();
} catch (CommitException e) {
e.printStackTrace();
}
}
}
});
saveEditor does not close editor by a design decision, you need to explicitly close it (via cancelEditor).
See if you can get it working with that. If not, then we need to further investigate the matter