I’m new with Vaadin and now I have encountered a problem
How can you set a whole table column to be readonly?
I have a button that sets the table editable, but I don’t want all columns to be editable, only a few. How can I accomplish that?
I know how to set an individual cell value to be readonly, i.e. with
If you are using a TableFieldFactory to create the fields for an editable table, you can set the read-only property there for each component in the particular column (property).
If you want just to get the text like in a Label, return null from the field factory for that column/cell and, if necessary, override Table.formatPropertyValue().
If you need a Label component (e.g. for the icon), use a generated column (see Table.addGeneratedColumn()) or make a property in your data model with the type Component or Label and put your labels in the data model. I would recommend the former approach in most cases. See e.g.
this example (somewhat larger than necessary).