diff options
author | Tatu Lund <tatu@vaadin.com> | 2019-03-11 09:55:05 +0200 |
---|---|---|
committer | Olli Tietäväinen <ollit@vaadin.com> | 2019-03-11 09:55:05 +0200 |
commit | 1ccab1ce52eeb95f758756989dd0f2136861a25a (patch) | |
tree | d7147d44a3504968b0875303ac327d0ba86b2148 | |
parent | 1e7cd3ef157396bc92ef47445e962b3ff68ceda3 (diff) | |
download | vaadin-framework-1ccab1ce52eeb95f758756989dd0f2136861a25a.tar.gz vaadin-framework-1ccab1ce52eeb95f758756989dd0f2136861a25a.zip |
Catch exception that is thrown when Grid is scrolled during operation (#11467)7.7.17
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
-rwxr-xr-x | client/src/main/java/com/vaadin/client/widgets/Grid.java | 20 |
1 files changed, 13 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 4f0b012a00..06565e13f2 100755 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/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 } } |