Skip to content

Commit

Permalink
Catch exception that is thrown when Grid is scrolled during operation (
Browse files Browse the repository at this point in the history
…#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 #11467
  • Loading branch information
TatuLund authored May 14, 2020
1 parent e39ca99 commit 4277b50
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2145,13 +2145,19 @@ private void updateHorizontalScrollPosition() {

// 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
}
}

Expand Down

0 comments on commit 4277b50

Please sign in to comment.