Преглед на файлове

Catch exception that is thrown when Grid is scrolled during operation (#12002)

IllegalStateException may occur if user has scrolled Grid (compatibility library version) so that Escalator has updated, and row under Editor is no longer there

Chrerry pick from https://github.com/vaadin/framework/pull/11467
tags/8.12.0.alpha1
Tatu Lund преди 4 години
родител
ревизия
4277b50449
No account linked to committer's email address
променени са 1 файла, в които са добавени 13 реда и са изтрити 7 реда
  1. 13
    7
      compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java

+ 13
- 7
compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java Целия файл

@@ -2145,13 +2145,19 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,

// sometimes focus handling twists the editor row out of alignment
// with the grid itself and the position needs to be compensated for
TableRowElement rowElement = grid.getEscalator().getBody()
.getRowElement(grid.getEditor().getRow());
int rowLeft = rowElement.getAbsoluteLeft();
int editorLeft = cellWrapper.getAbsoluteLeft();
if (editorLeft != rowLeft + frozenWidth) {
cellWrapper.getStyle().setLeft(newLeft + rowLeft - editorLeft,
Unit.PX);
try {
TableRowElement rowElement = grid.getEscalator().getBody()
.getRowElement(grid.getEditor().getRow());
int rowLeft = rowElement.getAbsoluteLeft();
int editorLeft = cellWrapper.getAbsoluteLeft();
if (editorLeft != rowLeft + frozenWidth) {
cellWrapper.getStyle().setLeft(newLeft + rowLeft - editorLeft,
Unit.PX);
}
} catch (IllegalStateException e) {
// IllegalStateException may occur if user has scrolled Grid so
// that Escalator has updated, and row under Editor is no longer
// there
}
}


Loading…
Отказ
Запис