summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2018-07-13 15:08:47 +0300
committerTeemu Suo-Anttila <tsuoanttila@users.noreply.github.com>2018-07-30 16:45:46 +0300
commitb5ab24eee4635e471d311b470dd84cc1287095c7 (patch)
tree0a8ebe14f04e77ed1986f010bebb511bead3c587
parentc5b864d92dd9c4aa3706086a77ef2e30e5f543a1 (diff)
downloadvaadin-framework-b5ab24eee4635e471d311b470dd84cc1287095c7.tar.gz
vaadin-framework-b5ab24eee4635e471d311b470dd84cc1287095c7.zip
Fix Grid internal size calculations on vertical resize (#11046)
(cherry picked from commit 17761dc)
-rwxr-xr-xclient/src/main/java/com/vaadin/client/widgets/Grid.java16
1 files changed, 12 insertions, 4 deletions
diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java
index fbfae78ac5..7b013f8d87 100755
--- a/client/src/main/java/com/vaadin/client/widgets/Grid.java
+++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java
@@ -76,10 +76,7 @@ import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.ResizeComposite;
import com.google.gwt.user.client.ui.Widget;
-import com.vaadin.client.BrowserInfo;
-import com.vaadin.client.DeferredWorker;
-import com.vaadin.client.Focusable;
-import com.vaadin.client.WidgetUtil;
+import com.vaadin.client.*;
import com.vaadin.client.WidgetUtil.Reference;
import com.vaadin.client.data.DataChangeHandler;
import com.vaadin.client.data.DataSource;
@@ -3342,6 +3339,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
*/
private class AutoColumnWidthsRecalculator {
private double lastCalculatedInnerWidth = -1;
+ private double lastCalculatedInnerHeight = -1;
private final ScheduledCommand calculateCommand = new ScheduledCommand() {
@@ -3434,6 +3432,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
// Update latest width to prevent recalculate on height change.
lastCalculatedInnerWidth = escalator.getInnerWidth();
+ lastCalculatedInnerHeight = getEscalatorInnerHeight();
}
private boolean columnsAreGuaranteedToBeWiderThanGrid() {
@@ -9146,6 +9145,10 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
recalculateColumnWidths();
}
+ if (getEscalatorInnerHeight() != autoColumnWidthsRecalculator.lastCalculatedInnerHeight) {
+ resetSizesFromDom();
+ }
+
// Vertical resizing could make editor positioning invalid so it
// needs to be recalculated on resize
if (isEditorActive()) {
@@ -9159,6 +9162,11 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
});
}
+ private double getEscalatorInnerHeight() {
+ return new ComputedStyle(getEscalator().getTableWrapper())
+ .getHeightIncludingBorderPadding();
+ }
+
/**
* Grid does not support adding Widgets this way.
* <p>