diff options
author | Teemu Suo-Anttila <tsuoanttila@users.noreply.github.com> | 2017-07-03 14:00:38 +0300 |
---|---|---|
committer | Henri Sara <henri.sara@gmail.com> | 2017-07-03 14:00:38 +0300 |
commit | 4d085fd8b3589db4fbbdcd52643cee4b20f70e31 (patch) | |
tree | 4508f18126c66fca4578bf4b4a03b6c219729055 /server/src | |
parent | e9dd04e847c4fbf12320caa07142132391869c6d (diff) | |
download | vaadin-framework-4d085fd8b3589db4fbbdcd52643cee4b20f70e31.tar.gz vaadin-framework-4d085fd8b3589db4fbbdcd52643cee4b20f70e31.zip |
Map column components by id (#9624)
Fixes #9452
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/Grid.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index b67b77b90e..28b7ebcc60 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -872,7 +872,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, @Override public void destroyData(T item) { - removeComponent(item); + removeComponent(getGrid().getDataProvider().getId(item)); } @Override @@ -885,7 +885,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, }; private Binding<T, ?> editorBinding; - private Map<T, Component> activeComponents = new HashMap<>(); + private Map<Object, Component> activeComponents = new HashMap<>(); private String userId; @@ -1038,12 +1038,13 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, // Make Grid track components. if (renderer instanceof ComponentRenderer && presentationValue instanceof Component) { - addComponent(item, (Component) presentationValue); + addComponent(getGrid().getDataProvider().getId(item), + (Component) presentationValue); } return ((Renderer<P>) renderer).encode(presentationValue); } - private void addComponent(T item, Component component) { + private void addComponent(Object item, Component component) { if (activeComponents.containsKey(item)) { if (activeComponents.get(item).equals(component)) { // Reusing old component @@ -1055,7 +1056,7 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, getGrid().addExtensionComponent(component); } - private void removeComponent(T item) { + private void removeComponent(Object item) { Component component = activeComponents.remove(item); if (component != null) { getGrid().removeExtensionComponent(component); |