diff options
author | Anna Koskinen <Ansku@users.noreply.github.com> | 2019-05-20 09:35:49 +0300 |
---|---|---|
committer | Sun Zhe <31067185+ZheSun88@users.noreply.github.com> | 2019-05-20 09:35:49 +0300 |
commit | 994f39b9ed46519ca3bfdc8914291e364e44694f (patch) | |
tree | 6f3e41040e88ea962af9ac77b611af2dd6387734 /client | |
parent | 4cd5f44e360ec68373d5a1b9b498c5553c04dc26 (diff) | |
download | vaadin-framework-994f39b9ed46519ca3bfdc8914291e364e44694f.tar.gz vaadin-framework-994f39b9ed46519ca3bfdc8914291e364e44694f.zip |
Don't attempt to scroll to the beginning or end if Grid has no rows. (#11570)
Fixes #11558
Diffstat (limited to 'client')
-rwxr-xr-x | client/src/main/java/com/vaadin/client/widgets/Grid.java | 10 |
1 files changed, 7 insertions, 3 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 7add1fd654..cb43bdd7d1 100755 --- a/client/src/main/java/com/vaadin/client/widgets/Grid.java +++ b/client/src/main/java/com/vaadin/client/widgets/Grid.java @@ -7492,15 +7492,19 @@ public class Grid<T> extends ResizeComposite implements HasSelectionHandlers<T>, * Scrolls to the beginning of the very first row. */ public void scrollToStart() { - scrollToRow(0, ScrollDestination.START); + if (getEscalator().getBody().getRowCount() > 0) { + scrollToRow(0, ScrollDestination.START); + } } /** * Scrolls to the end of the very last row. */ public void scrollToEnd() { - scrollToRow(escalator.getBody().getRowCount() - 1, - ScrollDestination.END); + if (getEscalator().getBody().getRowCount() > 0) { + scrollToRow(escalator.getBody().getRowCount() - 1, + ScrollDestination.END); + } } /** |