aboutsummaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/src/main/java/com/vaadin/client/connectors/grid/DetailsManagerConnector.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/connectors/grid/DetailsManagerConnector.java b/client/src/main/java/com/vaadin/client/connectors/grid/DetailsManagerConnector.java
index 5290effdfa..b419aef724 100644
--- a/client/src/main/java/com/vaadin/client/connectors/grid/DetailsManagerConnector.java
+++ b/client/src/main/java/com/vaadin/client/connectors/grid/DetailsManagerConnector.java
@@ -17,6 +17,7 @@ package com.vaadin.client.connectors.grid;
import java.util.HashMap;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.TreeMap;
import com.google.gwt.core.client.Scheduler;
@@ -680,6 +681,18 @@ public class DetailsManagerConnector extends AbstractExtensionConnector {
getWidget().setDetailsVisible(rowIndex, false);
}
+ private void detachDetailsIfFound(String connectorId) {
+ if (indexToDetailConnectorId.containsValue(connectorId)) {
+ for (Entry<Integer, String> entry : indexToDetailConnectorId
+ .entrySet()) {
+ if (connectorId.equals(entry.getValue())) {
+ detachDetails(entry.getKey());
+ return;
+ }
+ }
+ }
+ }
+
private boolean refreshDetails(int rowIndex) {
String id = getDetailsComponentConnectorId(rowIndex);
String oldId = indexToDetailConnectorId.get(rowIndex);
@@ -706,6 +719,11 @@ public class DetailsManagerConnector extends AbstractExtensionConnector {
indexToDetailConnectorId.remove(rowIndex);
} else {
// updated, replace reference
+
+ // ensure that the detail contents aren't still attached to some
+ // other row that hasn't been refreshed yet
+ detachDetailsIfFound(id);
+
indexToDetailConnectorId.put(rowIndex, id);
newOrUpdatedDetails = true;
getWidget().resetVisibleDetails(rowIndex);
@@ -714,6 +732,11 @@ public class DetailsManagerConnector extends AbstractExtensionConnector {
// new Details content, listeners will get attached to the connector
// when Escalator requests for the Details through
// CustomDetailsGenerator#getDetails(int)
+
+ // ensure that the detail contents aren't still attached to some
+ // other row that hasn't been refreshed yet
+ detachDetailsIfFound(id);
+
indexToDetailConnectorId.put(rowIndex, id);
newOrUpdatedDetails = true;
getWidget().setDetailsVisible(rowIndex, true);