diff options
author | Artur Signell <artur@vaadin.com> | 2016-10-25 18:27:20 +0300 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2016-12-09 09:39:00 +0200 |
commit | cd4045b14a3ed1f557db36b6f9bf5cf80334cb64 (patch) | |
tree | daf709eaf8fd5e1022ccb3097e7b8d4aaa13178d /client | |
parent | 26dac6ff92b38ffec2491c7e1d12585ca20dfa10 (diff) | |
download | vaadin-framework-cd4045b14a3ed1f557db36b6f9bf5cf80334cb64.tar.gz vaadin-framework-cd4045b14a3ed1f557db36b6f9bf5cf80334cb64.zip |
Ensure #cell[N] always scrolls row N into view (#20423)
Change-Id: I99347ee1d0f2f13fcb8e110d2e7192590e4f9456
Diffstat (limited to 'client')
-rw-r--r-- | client/src/main/java/com/vaadin/client/widgets/Escalator.java | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/client/src/main/java/com/vaadin/client/widgets/Escalator.java b/client/src/main/java/com/vaadin/client/widgets/Escalator.java index 3d2c80ddbe..e3e0dfa0e4 100644 --- a/client/src/main/java/com/vaadin/client/widgets/Escalator.java +++ b/client/src/main/java/com/vaadin/client/widgets/Escalator.java @@ -6616,15 +6616,19 @@ public class Escalator extends Widget } else if (type.equalsIgnoreCase("cell")) { // If wanted row is not visible, we need to scroll there. Range visibleRowRange = getVisibleRowRange(); - if (indices.length > 0 && !visibleRowRange.contains(indices[0])) { - try { - scrollToRow(indices[0], ScrollDestination.ANY, 0); - } catch (IllegalArgumentException e) { - getLogger().log(Level.SEVERE, e.getMessage()); + if (indices.length > 0) { + // Contains a row number, ensure it is available and visible + boolean rowInCache = visibleRowRange.contains(indices[0]); + + // Scrolling might be a no-op if row is already in the viewport + scrollToRow(indices[0], ScrollDestination.ANY, 0); + + if (!rowInCache) { + // Row was not in cache, scrolling caused lazy loading and + // the caller needs to wait and call this method again to be + // able to get the requested element + return null; } - // Scrolling causes a lazy loading event. No element can - // currently be retrieved. - return null; } container = getBody(); } else if (type.equalsIgnoreCase("footer")) { |