web-components
web-components copied to clipboard
[grid-pro] Provide a configuration which row is editable
Describe your motivation
In some applications not all rows should be editable. Some could be summaries or the user is not allowed to edit them (readonly / un-editable).
Describe the solution you'd like
grid.addEditColumn(GridRow::getValue)
.text((item, newValue) -> {
item.setValue(newValue);
})
.setEditAllowed(e -> e.isLocked() ? false : true);
Alternative
Use a custom field as editor and add addCellEditStartedListener
to disable the fields if the user is not allowed to edit it.. not really good UX tho.. Why should somebody TAB
inside a field that isn't allowed to be edited?
Just adding a comment to use the words "uneditable", "gridpro" and "readonly" so this issue might show up in more searches 😃
This should be resolved with https://github.com/vaadin/flow-components/pull/6158