Closed jcgueriaud1 closed 2 years ago
When I call setValue the old value is kept and concatenated, instead of being set like it should. Is it intended?
setValue
For example if you have an entity bound and run setBean it will keep the old values.
setBean
Here is an example to reproduce the issue:
@PageTitle("Twin Col Grid") @Route(value = "twincol", layout = MainLayout.class) public class TwinColGridView extends VerticalLayout { private Button button; private TwinColGrid<String> twinColGrid = new TwinColGrid<>("TwinCol"); private List<String> items = new ArrayList<>(); public TwinColGridView() { for (int i = 0; i < 10; i++) { items.add("Item "+ i); } twinColGrid.addColumn(item -> item, "item"); twinColGrid.setItems(items.stream()); twinColGrid.setSizeFull(); button = new Button("set Value"); button.addClickListener(e -> { twinColGrid.setValue(Collections.singleton(items.stream().findFirst().get())); }); add(twinColGrid, button); setSizeFull(); } }
It's not intended. It breaks the contract of setValue.
Fix released in version 2.7.1
When I call
setValue
the old value is kept and concatenated, instead of being set like it should. Is it intended?For example if you have an entity bound and run
setBean
it will keep the old values.Here is an example to reproduce the issue: