Context menu on editable table?

Hi:

When I right-click on a non-editable table, I get the table actions as defined in the manual. However, when I right-click on an editable field in a table, I get the browser’s context menu (or maybe it is a TextField context menu?)

Is there any way to get the table context menu when right-clicking on an editable table field?

Hi,

The browser context menu is shown on purpose, see the issue.

In order to show the table actions context menu, you need to the client-side table implementation.

  1. Create a web-toolkit module
  2. Extend CubaScrollTableConnector
import com.haulmont.cuba.web.widgets.CubaTable;
import com.haulmont.cuba.web.widgets.client.table.CubaScrollTableConnector;
import com.vaadin.shared.ui.Connect;

@Connect(value = CubaTable.class, loadStyle = Connect.LoadStyle.EAGER)
public class CustomScrollTableConnector extends CubaScrollTableConnector {
    @Override
    public CustomScrollTableWidget getWidget() {
        return (CustomScrollTableWidget) super.getWidget();
    }
}
  1. Extend CubaScrollTableWidget
import com.google.gwt.user.client.Event;
import com.haulmont.cuba.web.widgets.client.table.CubaScrollTableWidget;

public class CustomScrollTableWidget extends CubaScrollTableWidget {
    @Override
    protected boolean isShowBrowserContextMenu(Event event) {
        return false;
    }
}

Demo project: table-context-menu.zip (85.0 KB)

Regards,
Gleb

Hmmm, I wonder what the reasoning was. Doesn’t matter, I guess. Thanks for this.

My simple solution was to generate a small label empty column as the first column of the table. Users can right click that field to get the table context menu.

Seems like a good compromise.

image