Open stefanuebe opened 1 year ago
Although we could add a convenience method for toggling these specific features, you can already today do that with separate methods for each feature (showing Flow example here):
grid.setSelectionMode(SelectionMode.NONE);
grid.setRowsDraggable(false);
grid.setColumnReorderingAllowed(false);
// and for individual columns
someColumn.setSortable(false);
someColumn.setResizable(false);
The exception is clicklisteners (assuming you mean custom clicklisteners), but those would probably make sense to handle in the logic of the clicklisteners themseleves, as very much it depends on the listener whether what it does can be considered "editing".
For GridPro there are a couple of feature tickets about toggling the editability: https://github.com/vaadin/web-components/issues/3464 and https://github.com/vaadin/web-components/issues/985.
Just for the record Grid#setReadOnly was added in Vaadin 8.22.0.
Describe your motivation
Follow up ticket of https://github.com/vaadin/web-components/issues/5719. Also not sure if this could/would be a flow-component ticket.
Currently it is not easily possible to provide a readonly grid, that allows presenting data, but not modify anything with interaction. Therefore it should be possible to mark a grid as "readonly", so that the contained data is presented, scrollable and text selectable (via cursor), but have anything else disabled.
Describe the solution you'd like
A readonly grid should provide a dedicated style as our other components to.
Also it should automatically disable certain functions to make developer lives easier.
Disabled functionalities:
Enabled functionalities:
Describe alternatives you've considered
Doing all the styling and disabling myself. Not the best DX #ffs
Additional context
No response