I’ve investigated your project more closely and found that the problem is that you change editorEnabled programmatically. After I removed all lines changing editorEnabled the problem is gone. So it appears that the problem isn’t related to CUBA.
If you look at OrderEdit there is a BeforeActionPerformed set on EditActionin order to hide computed columns (i.e amount) before editing, letting more width space for edition.
The problem with Datagrid is that when editor is enabled, then ENTER key opens directly grid internal editor without passing through EditAction, and so bypassing the BeforeActionPerformed handler.
The problem is in WebDataGrid.initComponent:
component.addShortcutListener(new ShortcutListener("dataGridEnter", KeyCode.ENTER, null) {
@Override
public void handleAction(Object sender, Object target) {
CubaGrid dataGridComponent = WebDataGrid.this.component;
if (target == dataGridComponent) {
if (WebDataGrid.this.isEditorEnabled()) {
// Prevent custom actions on Enter if DataGrid editor is enabled
// since it's the default shortcut to open editor
return;
}
So if I want my EditAction and particularly its BeforeActionPerformed to work, I have no choice to use this trick… that you have advised yourself in this post.
And in fact, I don’t think this trick used in OrderEdit is the culprit. Try with sample project reattached :
open Orders, enter on a line, this opens OrderEdit.
open Customers (has a grid), open Orders, enter on a line, does not open OrderEdit
close Customers tab, go back to Orders, enter on a line, it now works
As you can see the issue happens even before OrderEdit is open, so it cannot be the cause.