Open anasmi opened 5 years ago
Grid-pro:1.0.0 Affected line: ((HasEnabled)grid.getColumnByKey("city") .getEditorComponent()).setEnabled(false); Code to reproduce:
((HasEnabled)grid.getColumnByKey("city") .getEditorComponent()).setEnabled(false);
public class ProGridView extends VerticalLayout { GridPro<Person> grid; public ProGridView(){ add(createGridPro()); add(new Button("Change editor", e->{ //NPE here ((HasEnabled)grid.getColumnByKey("city") .getEditorComponent()).setEnabled(false); })); } private GridPro createGridPro(){ grid = new GridPro<>(); grid.addColumn(Person::getFirstName).setEditorComponent(new TextField()).setHeader("First Name").setKey("firstName"); grid.addEditColumn(Person::getLastName).text((oldValue,newValue)->{}).setHeader("Last name").setKey("lastName"); grid.addEditColumn(Person::getCity).select((oldValue,newValue)->{}, PersonRepository.getCities()).setHeader("Cities").setKey("city"); grid.addEditColumn(Person::getAge); grid.setItems(new PersonRepository().getPersons()); return grid; } }
Might be related to this: https://github.com/vaadin/vaadin-grid-flow/issues/604
The following workaround might help: https://cookbook.vaadin.com/grid-pro-conditional-edit
I created a feature request that can address this as well here: https://github.com/vaadin/flow-components/issues/4524
Grid-pro:1.0.0 Affected line:
((HasEnabled)grid.getColumnByKey("city") .getEditorComponent()).setEnabled(false);
Code to reproduce:Might be related to this: https://github.com/vaadin/vaadin-grid-flow/issues/604