summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-07-09 12:31:47 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2015-07-10 15:16:40 +0300
commit044daf86d80a2dc4c84127c783e383bdd7e111ab (patch)
tree0f1afc50c132e76bcdac09c363a1e90dd76165bf /client
parent1e42eaf93252cbe8c9e16e2273049f0f69f3dc63 (diff)
downloadvaadin-framework-044daf86d80a2dc4c84127c783e383bdd7e111ab.tar.gz
vaadin-framework-044daf86d80a2dc4c84127c783e383bdd7e111ab.zip
Fix displaying Details when Grid is attached to DOM (#18390)
Change-Id: Ib892eb4d40bbb655113d21b622cc117d54b2cebc
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/connectors/GridConnector.java28
-rw-r--r--client/src/com/vaadin/client/widgets/Grid.java3
2 files changed, 23 insertions, 8 deletions
diff --git a/client/src/com/vaadin/client/connectors/GridConnector.java b/client/src/com/vaadin/client/connectors/GridConnector.java
index b720dc442f..ef52a429e7 100644
--- a/client/src/com/vaadin/client/connectors/GridConnector.java
+++ b/client/src/com/vaadin/client/connectors/GridConnector.java
@@ -735,13 +735,20 @@ public class GridConnector extends AbstractHasComponentsConnector implements
private final DetailsListener detailsListener = new DetailsListener() {
@Override
- public void reapplyDetailsVisibility(int rowIndex, JsonObject row) {
- if (hasDetailsOpen(row)) {
- getWidget().setDetailsVisible(rowIndex, true);
- detailsConnectorFetcher.schedule();
- } else {
- getWidget().setDetailsVisible(rowIndex, false);
- }
+ public void reapplyDetailsVisibility(final int rowIndex,
+ final JsonObject row) {
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+
+ @Override
+ public void execute() {
+ if (hasDetailsOpen(row)) {
+ getWidget().setDetailsVisible(rowIndex, true);
+ detailsConnectorFetcher.schedule();
+ } else {
+ getWidget().setDetailsVisible(rowIndex, false);
+ }
+ }
+ });
}
private boolean hasDetailsOpen(JsonObject row) {
@@ -912,6 +919,13 @@ public class GridConnector extends AbstractHasComponentsConnector implements
}
@Override
+ public void onUnregister() {
+ customDetailsGenerator.indexToDetailsMap.clear();
+
+ super.onUnregister();
+ }
+
+ @Override
public void onStateChanged(final StateChangeEvent stateChangeEvent) {
super.onStateChanged(stateChangeEvent);
diff --git a/client/src/com/vaadin/client/widgets/Grid.java b/client/src/com/vaadin/client/widgets/Grid.java
index 6d9e5d18ec..53ccd432c4 100644
--- a/client/src/com/vaadin/client/widgets/Grid.java
+++ b/client/src/com/vaadin/client/widgets/Grid.java
@@ -7649,7 +7649,8 @@ public class Grid<T> extends ResizeComposite implements
@Override
protected void onDetach() {
- for (int row : visibleDetails) {
+ Set<Integer> details = new HashSet<Integer>(visibleDetails);
+ for (int row : details) {
setDetailsVisible(row, false);
}