How to commit datagrid inline editing changes

Jmix 2.3.1

How can I commit the DataGrid inline editing changes to database? They are not being saved in database automatically.

Hello!

You can use DataManager and saveListener in case you have collection container or view’s DataContext that is read only.

Example of read only DataContext

See DataContext :: Jmix Documentation):

<data readOnly="true">
    ...        
</data>
Example of read only loader
<loader id="myDl" readOnly="true">

You should subscribe to saveListener and then save entity instance:

<dataGrid id="usersDataGrid"
          editorBuffered="true" ...>
    <columns>
        ....
        <editorActionsColumn>
            <editButton icon="EDIT"/>
            <saveButton icon="CHECK"/>
        </editorActionsColumn>
    </columns>
</dataGrid>
@Autowired
private DataManager dataManager;

@Install(to = "usersDataGrid.@editor", subject = "saveListener")
private void usersDataGridEditorSaveListener(final EditorSaveEvent<User> event) {
    dataManager.save(event.getItem());
}

If you want to use an inline editor in detail views, consider the relationship of this entity with others in the detail view. And, probably, not to use immediate entity saving but instead rely on DataContext saving.