There seems to be an issue with the Enhanced Tree Grid under Vaadin 23.2.0.
When refreshing the dataProvider of the grid, the expanded nodes glitch in a 'flashing' state for a moment, but when the same is done when the grid is in the background (e.g. a Dialog is opened) the expanded rows of the grid stay in a broken state, all opened nodes need to be clicked twice to be opened again.
The issue can be reproduced using the following simple example (also added a regular TreeGrid with the same logic that seems to be working properly):
public class ExampleLayout extends VerticalLayout { Example ex1 = new Example(); ex1.setA("1"); Example ex2 = new Example(); ex2.setA("2"); ex2.setB(ex1); Example ex3 = new Example(); ex3.setA("3"); Example ex4 = new Example(); ex4.setA("4"); ex4.setB(ex3); List<Example> gridList = new ArrayList<>(); gridList.add(ex2); gridList.add(ex4); TreeGrid<Example> grid1 = new TreeGrid<>(); grid1.setItems(gridList, Example::getB); grid1.addHierarchyColumn(Example::getA).setHeader("A"); grid1.setHeight("200px"); EnhancedTreeGrid<Example> grid2 = new EnhancedTreeGrid<>(); grid2.setItems(gridList, Example::getB); grid2.addHierarchyColumn(Example::getA).setHeader("A"); grid2.setHeight("200px");Button button = new Button(“Open dialog”);
Dialog dialog = new Dialog();
Button button2 = new Button(“Update grids”);
dialog.add(button2);
button.addClickListener(event -> dialog.open());
button2.addClickListener(event -> {
grid1.getDataProvider().refreshAll();
grid2.getDataProvider().refreshAll();
});Button button3 = new Button(“Update grids”);
button3.addClickListener(event -> {
grid1.getDataProvider().refreshAll();
grid2.getDataProvider().refreshAll();
});add(grid1, grid2, button, button3);
}public class Example {
private String a;
private List<Example> b = new ArrayList<>();public String getA() {
return a;
}public void setA(String a) {
this.a = a;
}public List<Example> getB() {
return b;
}public void setB(Example b) {
this.b.add(b);
}
}