diff options
author | John Ahlroos <john@vaadin.com> | 2013-10-02 16:33:41 +0300 |
---|---|---|
committer | John Ahlroos <john@vaadin.com> | 2013-10-02 16:33:41 +0300 |
commit | 0e9ff32598ed86d5f24a8bce5c5c898d81dc2c84 (patch) | |
tree | aba102c194b1736c5213d4c1d684d3824ec6e245 | |
parent | d0e604f6b509767c46ffe0fd6765cf23535f593e (diff) | |
download | vaadin-framework-0e9ff32598ed86d5f24a8bce5c5c898d81dc2c84.tar.gz vaadin-framework-0e9ff32598ed86d5f24a8bce5c5c898d81dc2c84.zip |
Ported regression fixes in 6.8 for #12407 to 7.1 branch
Change-Id: Ie46ab97fc1ff89dd241eec9182ed0f92164b754d
-rw-r--r-- | client/src/com/vaadin/client/ui/VScrollTable.java | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java index 492730259a..6e9e28ff25 100644 --- a/client/src/com/vaadin/client/ui/VScrollTable.java +++ b/client/src/com/vaadin/client/ui/VScrollTable.java @@ -1113,14 +1113,16 @@ public class VScrollTable extends FlowPanel implements HasWidgets, private ScheduledCommand lazyScroller = new ScheduledCommand() { @Override public void execute() { - if (firstvisibleOnLastPage > -1) { - scrollBodyPanel - .setScrollPosition(measureRowHeightOffset(firstvisibleOnLastPage)); - } else { - scrollBodyPanel - .setScrollPosition(measureRowHeightOffset(firstvisible)); + if (firstvisible > 0) { + firstRowInViewPort = firstvisible; + if (firstvisibleOnLastPage > -1) { + scrollBodyPanel + .setScrollPosition(measureRowHeightOffset(firstvisibleOnLastPage)); + } else { + scrollBodyPanel + .setScrollPosition(measureRowHeightOffset(firstvisible)); + } } - firstRowInViewPort = firstvisible; } }; @@ -1131,17 +1133,15 @@ public class VScrollTable extends FlowPanel implements HasWidgets, firstvisibleOnLastPage = uidl.hasVariable("firstvisibleonlastpage") ? uidl .getIntVariable("firstvisibleonlastpage") : -1; if (firstvisible != lastRequestedFirstvisible && scrollBody != null) { - // received 'surprising' firstvisible from server: scroll there - firstRowInViewPort = firstvisible; + // Update lastRequestedFirstvisible right away here // (don't rely on update in the timer which could be cancelled). lastRequestedFirstvisible = firstRowInViewPort; - /* - * Schedule the scrolling to be executed last so no updates to the - * rows affect scrolling measurements. - */ - Scheduler.get().scheduleFinally(lazyScroller); + // Only scroll if the first visible changes from the server side. + // Else we might unintentionally scroll even when the scroll + // position has not changed. + Scheduler.get().scheduleDeferred(lazyScroller); } } @@ -2160,7 +2160,9 @@ public class VScrollTable extends FlowPanel implements HasWidgets, isNewBody = false; - Scheduler.get().scheduleFinally(lazyScroller); + if (firstvisible > 0) { + Scheduler.get().scheduleDeferred(lazyScroller); + } if (enabled) { // Do we need cache rows |