Inline Datagrid editing on button click

I’m not sure if this is a bug, or I am not doing this correctly. My need is to create a more rapid data entry of a related entity using datagrid, rather than opening a new window each time. I have it somewhat working, however the editor does not open for the new record. This is what I have:

Entity e = metadata.create(“Entity”);
datagrid.getDatasource().addItem(e);
datagrid.editItem(e.getId());

This works (item is created, no errors) however the editor does not show, in fact running the action again will complain that the editor is already open. Can we get this fixed, or can someone tell me how to implement this properly.

Thanks.

I’ve played around with this some more. It seems that the editor will not show if it is trying to edit the last row of the collection. I’ve populated a datagrid with data, and I have tried 2 things. datagrid.scrollTo(Entity), and datagrid.editItem(Entity.getId()). Both fail when selecting the last item in the datagrid. scrollTo fails with an error of the item not existing in the datasource, and the editItem works, however the editor screen ui does not show. Selecting the record above will work. This is using:

Entity e = datagrid.getSingleSelected();
datagrid.editItem(e.getId());
datagrid.requestFocus();

can someone look into this bug.

Thanks.

Hi,

Thank you for reporting the problem. We have created a YouTrack issue, see the link on the right.

Regards,
Gleb

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/PL-9179