jmix-projects / jmix-ui

DEPRECATED. Use https://github.com/jmix-framework/jmix
https://www.jmix.io
3 stars 7 forks source link

[DataGrid] copy editFieldGenerator when adding a generated column #694

Closed glebfox closed 2 years ago

glebfox commented 2 years ago

If a user adds both columnGenerator and editFieldGenerator via @Install then the result generated column won't be editable, because editFieldGenerator is ignored while coping properties of prev column.

Steps to reproduce

  1. Change GroupTable in the UserBrowse to DataGrid
  2. Set editorEnabled="true"
  3. For username column in the controller use the following code:
    
    @Autowired
    private UiComponents uiComponents;

@Install(to = "usersTable.username", subject = "editFieldGenerator") private Field<?> usersTableUsernameEditFieldGenerator(DataGrid.EditorFieldGenerationContext editorFieldGenerationContext) { ComboBox comboBox = uiComponents.create(ComboBox.NAME); Map<String, String> map = new HashMap<>(); map.put("value1", "value1"); comboBox.setOptionsMap(map); return comboBox; }

@Install(to = "usersTable.username", subject = "columnGenerator") private String usersTableUsernameColumnGenerator(DataGrid.ColumnGeneratorEvent columnGeneratorEvent) { return "Generated username: " + columnGeneratorEvent.getItem().getUsername(); }


4. Launch the app.
5. Try to inline-edit record.

**ER**
ComboBox should be shown for the `username` column.

**AR**
"Generated username: admin" text is shown.
reznikova21 commented 2 years ago

1.2.0-SNAPSHOT - verified