aboutsummaryrefslogtreecommitdiffstats
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/com/vaadin/client/widget/escalator/RowContainer.java3
-rw-r--r--client/src/com/vaadin/client/widgets/Escalator.java11
2 files changed, 11 insertions, 3 deletions
diff --git a/client/src/com/vaadin/client/widget/escalator/RowContainer.java b/client/src/com/vaadin/client/widget/escalator/RowContainer.java
index e2baf9a03b..b7aae1f4f3 100644
--- a/client/src/com/vaadin/client/widget/escalator/RowContainer.java
+++ b/client/src/com/vaadin/client/widget/escalator/RowContainer.java
@@ -57,7 +57,8 @@ public interface RowContainer {
*
* @param rowIndex
* the row index for the spacer to modify. The affected
- * spacer is underneath the given index
+ * spacer is underneath the given index. Use -1 to insert a
+ * spacer before the first row
* @param height
* the pixel height of the spacer. If {@code height} is
* negative, the affected spacer (if exists) will be removed
diff --git a/client/src/com/vaadin/client/widgets/Escalator.java b/client/src/com/vaadin/client/widgets/Escalator.java
index 1d7d9a9910..9b11e7aec1 100644
--- a/client/src/com/vaadin/client/widgets/Escalator.java
+++ b/client/src/com/vaadin/client/widgets/Escalator.java
@@ -4453,8 +4453,15 @@ public class Escalator extends Widget implements RequiresResize,
.getScrollSize() + heightDiff);
}
+ /*
+ * Don't modify the scrollbars if we're expanding the -1 spacer
+ * while we're scrolled to the top.
+ */
+ boolean minusOneSpacerException = spacerIsGrowing
+ && getRow() == -1 && body.getTopRowLogicalIndex() == 0;
+
boolean viewportNeedsScrolling = getRow() < body
- .getTopRowLogicalIndex();
+ .getTopRowLogicalIndex() && !minusOneSpacerException;
if (viewportNeedsScrolling) {
/*
@@ -4570,7 +4577,7 @@ public class Escalator extends Widget implements RequiresResize,
public void setSpacer(int rowIndex, double height)
throws IllegalArgumentException {
- if (rowIndex < 0 || rowIndex >= getBody().getRowCount()) {
+ if (rowIndex < -1 || rowIndex >= getBody().getRowCount()) {
throw new IllegalArgumentException("invalid row index: "
+ rowIndex + ", while the body only has "
+ getBody().getRowCount() + " rows.");