瀏覽代碼

Catch exception that is thrown when Grid is scrolled during operation

IllegalStateException may occur if user has scrolled Grid so that Escalator has updated, and row under Editor is no longer there
Fixes https://github.com/vaadin/framework/issues/11463
fix11463
Tatu Lund 5 年之前
父節點
當前提交
cab1029796
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 13 行新增7 行删除
  1. 13
    7
      client/src/main/java/com/vaadin/client/widgets/Grid.java

+ 13
- 7
client/src/main/java/com/vaadin/client/widgets/Grid.java 查看文件

@@ -2140,15 +2140,21 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>,
double newLeft = frozenWidth - scrollLeft;
cellWrapper.getStyle().setLeft(newLeft, Unit.PX);

// 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()
try {
// 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,
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…
取消
儲存