]> source.dussan.org Git - vaadin-framework.git/commitdiff
Prevent reorder of frozen columns when there are hidden columns (#8278)
authorArtur <artur@vaadin.com>
Mon, 30 Jan 2017 13:19:55 +0000 (15:19 +0200)
committerDenis <denis@vaadin.com>
Mon, 30 Jan 2017 13:19:55 +0000 (15:19 +0200)
* Rename variables to indicate whether they use DOM index or Grid index

Grid indexes include hidden columns, DOM/Escalator indexes do not

* Prevent reorder of frozen columns when there are hidden columns

Fixes #8265

* Merge branch '7.7' into _grid-no-reorder-of-frozen-columns

* Merge branch '7.7' into _grid-no-reorder-of-frozen-columns

* Merge branch '7.7' into _grid-no-reorder-of-frozen-columns

* Merge branch '7.7' into _grid-no-reorder-of-frozen-columns

* Merge branch '7.7' into _grid-no-reorder-of-frozen-columns

* Merge branch '7.7' into _grid-no-reorder-of-frozen-columns

* Merge branch '7.7' into _grid-no-reorder-of-frozen-columns

client/src/main/java/com/vaadin/client/widgets/Grid.java
uitest/src/test/java/com/vaadin/tests/components/grid/basicfeatures/server/GridColumnReorderTest.java

index d215b3c565e1a347f97d80df328b11da4f097282..7ef2167f1ca99e3068bc11f707cfdac2cd1929c3 100755 (executable)
@@ -7602,8 +7602,7 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
             if (!event.getCell().isHeader()) {
                 return;
             }
-            if (event.getCell().getColumnIndex() < escalator
-                    .getColumnConfiguration().getFrozenColumnCount()) {
+            if (event.getCell().getColumnIndex() < getFrozenColumnCount()) {
                 return;
             }
 
index c6d6f44a006587c49d7dbee3f6fc249cfc8d8532..6e83c2503f34f015b458a1f66a8070b0d424ab55 100644 (file)
@@ -208,6 +208,29 @@ public class GridColumnReorderTest extends GridBasicFeaturesTest {
         assertFalse(getGridElement().getHeaderCell(0, 2).isFrozen());
     }
 
+    @Test
+    public void testColumnReorder_draggingFrozenColumnsContainingHiddenColumns_impossible() {
+        // given
+        openTestURL();
+        selectMenuPath("Component", "Size", "Width", "900px");
+        toggleColumnReordering();
+        setFrozenColumns(4);
+        toggleColumnHidden(1);
+        toggleColumnHidden(2);
+        assertColumnHeaderOrder(0, 3, 4, 5);
+
+        // when
+        // drag frozen column out between non-frozen columns
+        dragAndDropDefaultColumnHeader(1, 2, CellSide.RIGHT);
+
+        // then
+        // everything should be as before
+        assertColumnHeaderOrder(0, 3, 4, 5);
+        assertTrue(getGridElement().getHeaderCell(0, 0).isFrozen());
+        assertTrue(getGridElement().getHeaderCell(0, 1).isFrozen());
+        assertFalse(getGridElement().getHeaderCell(0, 2).isFrozen());
+    }
+
     @Test
     public void testColumnReorder_draggingColumnOnTopOfFrozenColumn_columnDroppedRightOfFrozenColumns() {
         // given