https://docs.jmix.io/jmix/flow-ui/vc/components/dataGrid.html#editable not working

I create a DataGrid and add columns which are editable by default.

Based on dataGrid :: Jmix Documentation, there is the attribute editable, which should be set to false.

But setEditable is not defined; what do I have to do ?

DataGridColumn<E> column = dataGrid.addColumn(metaPropertyPath);
column.setEditable(false);

Best regards

Felix

Hi!

The editable attribute is only available in XML because it carries more complex logic than simply setting a property on a column.
To set the editor programmatically, you can use the following code snippet:

DataGridColumn<E> column = dataGrid.addColumn(metaPropertyPath);
Editor<?> editor = dataGrid.getEditor();
if (editor instanceof DataGridEditor dataGridEditor) {
    dataGridEditor.initColumnDefaultEditorComponent(column, metaPropertyPath.toPathString());
}

Best regards,
Dmitriy

Thank you for your reply.

I think it would make sense, to put this in the documentation.

Best regards

Felix