diff options
author | mlindfors <majuli@vaadin.com> | 2018-12-05 16:39:09 +0200 |
---|---|---|
committer | Sun Zhe <31067185+ZheSun88@users.noreply.github.com> | 2018-12-05 16:39:09 +0200 |
commit | 3a7112895e3a54af7ba0346fc3d0cb3f99262156 (patch) | |
tree | c7c863bdc3e0ea8be83eaaf7db3948a023a8a3b2 /server | |
parent | ea22a7d17dcc82d2e28dbb0051fbb6904fd7c98d (diff) | |
download | vaadin-framework-3a7112895e3a54af7ba0346fc3d0cb3f99262156.tar.gz vaadin-framework-3a7112895e3a54af7ba0346fc3d0cb3f99262156.zip |
Fix Grid's frozen columns not being set (#10653) (#11346)
In certain cases setting the frozen columns didn't produce the expected result in the client side widget state. This happened if the frozen columns value was set to be the same it was before removeAllColumns was called.
This fix removes the frozen column value from the diff state so that the value gets properly set in the client side.
Closes #10653
Diffstat (limited to 'server')
-rw-r--r-- | server/src/main/java/com/vaadin/ui/Grid.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/server/src/main/java/com/vaadin/ui/Grid.java b/server/src/main/java/com/vaadin/ui/Grid.java index 2766f2cb88..7c3467eaa3 100644 --- a/server/src/main/java/com/vaadin/ui/Grid.java +++ b/server/src/main/java/com/vaadin/ui/Grid.java @@ -3082,7 +3082,21 @@ public class Grid<T> extends AbstractListing<T> implements HasComponents, "count must be between -1 and the current number of columns (" + columnSet.size() + "): " + numberOfColumns); } - + int currentFrozenColumnState = getState(false).frozenColumnCount; + /* + * we remove the current value from the state so that setting frozen + * columns will always happen after this call. This is so that the value + * will be set also in the widget even if it happens to seem to be the + * same as this current value we're setting. + */ + if (currentFrozenColumnState != numberOfColumns) { + final String diffStateKey = "frozenColumnCount"; + UI ui = getUI(); + if (ui != null) { + ui.getConnectorTracker().getDiffState(Grid.this) + .remove(diffStateKey); + } + } getState().frozenColumnCount = numberOfColumns; } |