aboutsummaryrefslogtreecommitdiffstats
path: root/compatibility-client
diff options
context:
space:
mode:
authorTatu Lund <tatu@vaadin.com>2020-05-14 15:02:58 +0300
committerGitHub <noreply@github.com>2020-05-14 15:02:58 +0300
commit4277b50449b47944c707f77c5e75a522bca84d40 (patch)
treed0fa05135a61e548911cda245930bde41cc690e8 /compatibility-client
parente39ca996546431f768f23fd9c36cec7f4f73df47 (diff)
downloadvaadin-framework-4277b50449b47944c707f77c5e75a522bca84d40.tar.gz
vaadin-framework-4277b50449b47944c707f77c5e75a522bca84d40.zip
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
Diffstat (limited to 'compatibility-client')
-rwxr-xr-xcompatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java b/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java
index 1d2f88f570..4a7265a525 100755
--- a/compatibility-client/src/main/java/com/vaadin/v7/client/widgets/Grid.java
+++ b/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
}
}