Framework: Programmatically open the editor row in Grid for an item based on row index

Created on 7 Feb 2017  路  7Comments  路  Source: vaadin/framework

Vaadin version: 8.0-SNAPSHOT

Apparently, there is no way to programmatically open the edit menu for Vaadin 8 Grid component.
It was possible in Vaadin 7.
Can you add the method to Vaadin 8 Grid please?

enhancement candidate

Most helpful comment

I'm all for just doing scrollToRow(int row) and editRow(int row) and leaving the index detection (potentially hard computationally) to the DataProvider. However, this should be done ASAP - currently, the new Grid is basically useless for editing lists containing an "add" button (I can add a bean, but under the new API I can't immediately open it for editing), which is probably one of the most appealing ways to use inline Grid editing.

I could probably code the editRow part, not sure if I know how to do the scrollToRow one though - any hints?

All 7 comments

In Vaadin 8 you can do: grid.getEditor().setEnabled(true);
We only do not have the shorthand from Vaadin 7 grid.setEditorEnabled(true);

I am talking about opening the actual edit dialog:
screen shot 2017-02-07 at 14 19 37

Vaadin 7 could do this with editItem method, Vaadin 8 can not do this at all, apparently.

That seems to be so as it's probably the same as protected void doEdit(T bean) in the editor implementation which is only called from the client side call to the RPC.bind method.

The issue is that our DataProvider is not providing indexes for arbitrary objects of type T. We could solve it similar to the scroll to row issue and have edit(int rowIndex).

This is now about row index based API (easy), #8820 is about item based API (difficult)

I'm all for just doing scrollToRow(int row) and editRow(int row) and leaving the index detection (potentially hard computationally) to the DataProvider. However, this should be done ASAP - currently, the new Grid is basically useless for editing lists containing an "add" button (I can add a bean, but under the new API I can't immediately open it for editing), which is probably one of the most appealing ways to use inline Grid editing.

I could probably code the editRow part, not sure if I know how to do the scrollToRow one though - any hints?

Created pull request for this, would welcome any comments.

Was this page helpful?
0 / 5 - 0 ratings