diff options
Diffstat (limited to 'server/src/main/java/com/vaadin')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/Grid.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index ec891396e9..f84dbd40cb 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -4997,7 +4997,17 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, @Override protected void internalSetDataProvider(DataProvider<T, ?> dataProvider) { + boolean newProvider = getDataProvider() != dataProvider; super.internalSetDataProvider(dataProvider); + if (newProvider) { + Set<T> oldVisibleDetails = new HashSet<>( + detailsManager.visibleDetails); + oldVisibleDetails.forEach(item -> { + // close all old details even if the same item exists in the new + // provider + detailsManager.setDetailsVisible(item, false); + }); + } for (Column<T, ?> column : getColumns()) { column.updateSortable(); } |