Vaadin Grid allows you to define as editable using
grid.setEditorEnabled(true);
This makes visible columns visible. However, I do not want the user to edit a specific column, but it seems that the editable is all or nothing.
The next best solution I found is to define an editor field with the editor disabled, which almost does the trick, but the user can still select the text and move the cursor (but the field is no longer being edited).
Grid.Column nameColumn = grid.getColumn("fullName"); nameColumn.setHeaderCaption("Full Name"); nameColumn.setEditorField(getNoEditableTextField()); ... private Field<?> getNoEditableTextField() { TextField noEditableTextFiled = new TextField(); noEditableTextFiled.setEnabled(false); return noEditableTextFiled; }
I believe the label cannot be used because it is not a field.
Is there a better option for this?
edit: as aakath said, there is a way to achieve this by not allowing the column to be edited, but the cell value disappears when editing the row, which is undesirable.
source share