Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DetailHandler refresh bug #12211

Closed
sarahfuchs opened this issue Mar 2, 2021 · 0 comments · Fixed by #12231
Closed

DetailHandler refresh bug #12211

sarahfuchs opened this issue Mar 2, 2021 · 0 comments · Fixed by #12231
Assignees

Comments

@sarahfuchs
Copy link

Bug:
Grid with detail handler: setItems and set another list of partly the same items scrambles the displayed details. Somtimes the UI looks broken, sometimes the contents of the details is faulty.

  • Vaadin Framework version: 8.12.3
  • Browser version: Chrome 88.0.4324.190
  • Web container name and version: Tomcat, v9.0
  • Description of the bug: Displays faulty details
  • Expected behavior: Display correct details. In the example, the row contains a collection of strings and the diplayed value is a space seperated list. The details are the same entries, but listed in a vertical layout.
  • Actual behavior: After resetting the items with a sub set of previous items, the displayed details do no longer fit to the row.

Minimal reproducible example

private VerticalLayout createExamplleLayout() {
Collection firstCollection = Arrays.asList("Hello", ",", "world!");
Collection secondCollection = Arrays.asList("My", "name", "is", "Sarah");
Collection thirdCollection = Arrays.asList("red", "blue");
Collection fourthCollection = Arrays.asList("spring", "summer", "automn", "winter");

VerticalLayout mainLayout = new VerticalLayout();
Grid<Collection<String>> grid = new Grid();
grid.setDetailsGenerator(collection -> {
  VerticalLayout detailLayout = new VerticalLayout();
  collection.forEach(item -> detailLayout.addComponent(new Label(item)));
  return detailLayout;
});
ValueProvider<Collection<String>, String> valueProvider = collection -> String.join(" ", collection);
grid.addColumn(valueProvider);

List<Collection<String>> itemsInitial = Arrays.asList(firstCollection, secondCollection, thirdCollection, fourthCollection);
grid.setItems(itemsInitial);
for (Collection<String> tmp : itemsInitial) {
  grid.setDetailsVisible(tmp, true);
}
mainLayout.addComponent(grid);

Button clickButton = new Button("click", event -> {
  List<Collection<String>> itemsOverwrite = Arrays.asList(secondCollection, fourthCollection);
  grid.setItems(itemsOverwrite);
  for (Collection<String> tmp : itemsOverwrite) {
    grid.setDetailsVisible(tmp, true);
  }
});
mainLayout.addComponent(clickButton);

return mainLayout;

}


image

image

@Ansku Ansku added the bug label Mar 2, 2021
@TatuLund TatuLund added the BFP label Mar 4, 2021
@Ansku Ansku self-assigned this Mar 4, 2021
Ansku added a commit to Ansku/framework that referenced this issue Mar 8, 2021
- Old details should close.
- New details should open.
- If some row has details in both old and new item set, the details row
contents should get updated.
- Updating details row contents should not break the positioning of the
rows and details below.

Fixes vaadin#12211
Ansku added a commit that referenced this issue Mar 8, 2021
- Old details should close.
- New details should open.
- If some row has details in both old and new item set, the details row
contents should get updated.
- Updating details row contents should not break the positioning of the
rows and details below.

Fixes #12211
Ansku added a commit to Ansku/framework that referenced this issue Mar 9, 2021
Ansku added a commit that referenced this issue Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants