From 83a1b8a0961cc9b2d43e01757530cefd035b0a22 Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 2 Sep 2016 08:19:35 +0300 Subject: Update DOM and update escalator row count in the correct order (#19442) If you show a column when Grid has no horizontal scrollbar, and is scrolled all the way down, and the number of visible rows is slightly more than N then Escalator will adjust the row count when the scrollbar is shown so that N-1 rows are visible. During this operation, the DOM must be updated for the new column. Change-Id: I0b6c845f96a57be1d64ef4e735aa2f77efbe589a --- .../src/main/java/com/vaadin/client/widgets/Escalator.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'client') diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java index 52f981fe63..d867907996 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -4166,6 +4166,11 @@ public class Escalator extends Widget implements RequiresResize, frozenColumns += numberOfColumns; } + // Add to DOM + header.paintInsertColumns(index, numberOfColumns, frozen); + body.paintInsertColumns(index, numberOfColumns, frozen); + footer.paintInsertColumns(index, numberOfColumns, frozen); + // this needs to be before the scrollbar adjustment. boolean scrollbarWasNeeded = horizontalScrollbar.getOffsetSize() < horizontalScrollbar .getScrollSize(); @@ -4173,14 +4178,12 @@ public class Escalator extends Widget implements RequiresResize, boolean scrollbarIsNowNeeded = horizontalScrollbar.getOffsetSize() < horizontalScrollbar .getScrollSize(); if (!scrollbarWasNeeded && scrollbarIsNowNeeded) { + // This might as a side effect move rows around (when scrolled + // all the way down) and require the DOM to be up to date, i.e. + // the column to be added body.verifyEscalatorCount(); } - // Add to DOM - header.paintInsertColumns(index, numberOfColumns, frozen); - body.paintInsertColumns(index, numberOfColumns, frozen); - footer.paintInsertColumns(index, numberOfColumns, frozen); - // fix initial width if (header.getRowCount() > 0 || body.getRowCount() > 0 || footer.getRowCount() > 0) { -- cgit v1.2.3