Control inline editor for DataGrid

I would like control whether the inline editor is started based on a status field in the entity, in a DataGrid.

E.g. if status=“N”, can edit record else cannot edit the record.

How can I control this for a datagrid ?



Take a look at DataGrid Editor events. You can subscribe to EditorOpenEvent, check entity property, and close editor:

public void onCustomersDataGridEditorOpen(DataGrid.EditorOpenEvent event) {
    Customer customer = (Customer) event.getItem();
    if (!customer.isEditable()) {

DataGrid doesn’t have a method for getting Editor, so we have to unwrap it with Vaadin type.

1 Like

Thanks. The code works.