diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2021-10-14 08:20:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-14 08:20:07 +0300 |
commit | 4a824f48655ba7ebfe1dd78c89e1a7c1fbd1c183 (patch) | |
tree | 3f7a1035974f544e890281d7f0773b1bca0b3458 /uitest/src/main/java/com | |
parent | 2cbaa342d34c0bee63a43ba51c21896e134dae87 (diff) | |
download | vaadin-framework-4a824f48655ba7ebfe1dd78c89e1a7c1fbd1c183.tar.gz vaadin-framework-4a824f48655ba7ebfe1dd78c89e1a7c1fbd1c183.zip |
Fix Grid column reorder with partially hidden joined header cells. (#12429)
Diffstat (limited to 'uitest/src/main/java/com')
-rw-r--r-- | uitest/src/main/java/com/vaadin/tests/components/grid/GridReorderMerged.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/uitest/src/main/java/com/vaadin/tests/components/grid/GridReorderMerged.java b/uitest/src/main/java/com/vaadin/tests/components/grid/GridReorderMerged.java new file mode 100644 index 0000000000..62ddef2c97 --- /dev/null +++ b/uitest/src/main/java/com/vaadin/tests/components/grid/GridReorderMerged.java @@ -0,0 +1,43 @@ +package com.vaadin.tests.components.grid; + +import java.util.ArrayList; +import java.util.List; + +import com.vaadin.server.VaadinRequest; +import com.vaadin.tests.components.AbstractTestUI; +import com.vaadin.ui.Grid; +import com.vaadin.ui.Grid.Column; +import com.vaadin.ui.components.grid.HeaderRow; + +public class GridReorderMerged extends AbstractTestUI { + + @Override + protected void setup(VaadinRequest request) { + Grid<String> grid = new Grid<>(); + List<String> items = new ArrayList<>(); + HeaderRow headerRow = grid.prependHeaderRow(); + for (int i = 1; i < 10; ++i) { + String propertyId = "" + i; + Column<String, ?> column = grid + .addColumn(item -> propertyId.equals(item) ? item : "") + .setId(propertyId).setCaption(propertyId); + column.setHidable(true); + if (i == 5) { + column.setHidden(true); + } + items.add(propertyId); + } + grid.setItems(items); + headerRow.join("1", "2", "3").setText("1"); + headerRow.join("4", "5", "6").setText("2"); // middle column hidden + headerRow.join("7", "8", "9").setText("3"); + grid.setColumnReorderingAllowed(true); + addComponent(grid); + } + + @Override + protected String getTestDescription() { + return "Reordering columns should respect joined cells " + + "even when some columns are hidden."; + } +} |