Grid does not close mini-editor programmatically

Hi,

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?

Hi,

We tried to replicate your issue, but were unable to see it. Which Vaadin version are you using? Do you have some modifications in your Grid?

//Teemu

Can you doublecheck if your error is the same as in this ticket (#18287)

https://dev.vaadin.com/ticket/18287

If so, it should have been fixed in Vaadin 7.4.8.

Hi,

thanks for the quick response.

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:

  1. Add shortcutListener ENTER to the Grid.
  2. Inside the ENTER Listener, execute function Grid.saveEditor()
  3. Run the program, doubleclick to edit a row, and press ENTER.
  4. The mini-editor should be deactived, but it is still actived

Thank you very much¡¡

Hi,

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

//Teemu

Thank you very much, that made the trick. :wink: