f.zehnder
(F Zehnder)
November 3, 2024, 3:00pm
1
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
d.kremnev
(Dmitriy Kremnev)
November 5, 2024, 5:27am
2
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
f.zehnder
(F Zehnder)
November 5, 2024, 8:03am
3
Thank you for your reply.
I think it would make sense, to put this in the documentation.
Best regards
Felix