vaadin/platform

Grid Pro: Conditional cell editability

Closed this issue · 1 comments

Description

An API in Grid for dynamically setting whether a cell is editable.
(Similar e.g. to PartNameGenerator and TooltipGenerator)

Acceptance criteria

  • Java API on the EditColumn class for setting an editability function setEditable(SerializableFunction<T,boolean> editabilityFunction)
  • WC API isCellEditable callback function (either on vaadin-grid-pro component or vaadin-grid-pro-edit-column*)
  • Cells for which the function returns false should be rendered as normal non-editable cells, without the editable-cell part name.

(precise naming of APIs is open for suggestions)

(* the latter would avoid possible confusion arising from being able to return true for cells in non-editable columns)

General criteria

Security

  • Security implications have been taken into account (elaborate or link to product security requirement specification if there are implications)

Java API on the EditColumn class for setting an editability function setEditable(SerializableFunction<T,boolean> editabilityFunction)

The EditColumn type is currently not exposed to developers, as doing so would result in issues with method chaining. Calling a method from the Column superclass would return a Column instance, after which it is not possible anymore to chain methods from EditColumn. Instead, currently all EditColumn specific configuration is done with the EditColumnConfigurator. As such I suggested adding a withCellEditableProvider API to the configurator in vaadin/flow-components#6158.