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 /client | |
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 'client')
-rwxr-xr-x | client/src/main/java/com/vaadin/client/widgets/Grid.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/client/src/main/java/com/vaadin/client/widgets/Grid.java b/client/src/main/java/com/vaadin/client/widgets/Grid.java index 14bf795e2e..bb12a71c7c 100755 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -175,7 +175,6 @@ import com.vaadin.client.widget.grid.sort.SortOrder; import com.vaadin.client.widgets.Escalator.AbstractRowContainer; import com.vaadin.client.widgets.Escalator.SubPartArguments; import com.vaadin.client.widgets.Grid.Editor.State; -import com.vaadin.client.widgets.Grid.StaticSection.StaticCell; import com.vaadin.client.widgets.Grid.StaticSection.StaticRow; import com.vaadin.shared.Range; import com.vaadin.shared.Registration; @@ -5123,8 +5122,11 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, @Override public void onDrop() { final int draggedColumnIndex = eventCell.getColumnIndex(); - final int colspan = header.getRow(eventCell.getRowIndex()) - .getCell(eventCell.getColumn()).getColspan(); + final StaticRow<?> draggedCellRow = header + .getRow(eventCell.getRowIndex()); + int colspan = draggedCellRow + .getSizeOfCellGroup(getColumn(draggedColumnIndex)); + colspan = colspan == 0 ? 1 : colspan; if (latestColumnDropIndex != draggedColumnIndex && latestColumnDropIndex != draggedColumnIndex + colspan) { List<Column<?, T>> columns = getColumns(); @@ -5261,13 +5263,12 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, } final boolean isDraggedCellRow = row.equals(draggedCellRow); for (int cellColumnIndex = frozenColumns; cellColumnIndex < getColumnCount(); cellColumnIndex++) { - StaticCell cell = row.getCell(getColumn(cellColumnIndex)); - int colspan = cell.getColspan(); + int colspan = row + .getSizeOfCellGroup(getColumn(cellColumnIndex)); if (colspan <= 1) { continue; } - final int cellColumnRightIndex = cellColumnIndex + row - .getSizeOfCellGroup(getColumn(cellColumnIndex)); + final int cellColumnRightIndex = cellColumnIndex + colspan; final Range cellRange = Range.between(cellColumnIndex, cellColumnRightIndex); final boolean intersects = draggedCellRange |