]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fix indexing issue in Grid resize when scrolled to bottom. (#11984)
authorAnna Koskinen <Ansku@users.noreply.github.com>
Fri, 8 May 2020 07:44:10 +0000 (10:44 +0300)
committerGitHub <noreply@github.com>
Fri, 8 May 2020 07:44:10 +0000 (10:44 +0300)
Fixes #11893

client/src/main/java/com/vaadin/client/widgets/Escalator.java
uitest/src/main/java/com/vaadin/tests/components/grid/GridScrollDownResize.java [new file with mode: 0644]

index 1cd24297f37c6300a1a4630d29fc9c7e6b50b177..bbc26b24374248b715d1865d67bc04e57848c365 100644 (file)
@@ -3770,6 +3770,7 @@ public class Escalator extends Widget
                                 visualRowOrder.getLast()) + 1;
                         moveAndUpdateEscalatorRows(Range.withOnly(0),
                                 visualRowOrder.size(), newLogicalIndex);
+                        updateTopRowLogicalIndex(1);
                     }
                 }
             }
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridScrollDownResize.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridScrollDownResize.java
new file mode 100644 (file)
index 0000000..8a89347
--- /dev/null
@@ -0,0 +1,34 @@
+package com.vaadin.tests.components.grid;
+
+import com.vaadin.server.VaadinRequest;
+import com.vaadin.tests.components.AbstractTestUI;
+import com.vaadin.tests.minitutorials.v7_4.GridExampleHelper;
+import com.vaadin.ui.Grid;
+import com.vaadin.ui.VerticalLayout;
+
+public class GridScrollDownResize extends AbstractTestUI {
+
+    @Override
+    protected void setup(VaadinRequest request) {
+        // container with at least 100 rows
+        final Grid grid = new Grid(GridExampleHelper.createContainer());
+        grid.setSizeFull();
+        addComponent(grid);
+        getLayout().setSizeFull();
+        getLayout().setExpandRatio(grid, 2);
+        ((VerticalLayout) getLayout().getParent()).setSizeFull();
+    }
+
+    @Override
+    protected Integer getTicketNumber() {
+        return 11893;
+    };
+
+    @Override
+    protected String getTestDescription() {
+        return "Scrolling all the way down, resizing the browser window smaller "
+                + "so that one row gets completely hidden, and scrolling down "
+                + "again should keep the row contents consistent and in expected "
+                + "sequence.";
+    }
+}