summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2013-02-28 09:31:32 +0200
committerVaadin Code Review <review@vaadin.com>2013-03-04 13:30:08 +0000
commit718b7dea773fddc47a316d82989e0759af6df67b (patch)
tree50dd5a04e5e02f63da72620633830d4a6724922e /client
parentda5a55ccdf3c5a1732ae246c43370051633c9265 (diff)
downloadvaadin-framework-718b7dea773fddc47a316d82989e0759af6df67b.tar.gz
vaadin-framework-718b7dea773fddc47a316d82989e0759af6df67b.zip
Fixed scrolling jumping up to first row when adding rows and adjusting the currentPageFirstItem in the same UIDL request #10970
Change-Id: I54562e7e0c5429f3493892cf3a14380b0d15bbfd
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/VScrollTable.java16
1 files changed, 14 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java
index c76dd38d8f..6f9fd6da88 100644
--- a/client/src/com/vaadin/client/ui/VScrollTable.java
+++ b/client/src/com/vaadin/client/ui/VScrollTable.java
@@ -1098,6 +1098,14 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
}
}
+ private ScheduledCommand lazyScroller = new ScheduledCommand() {
+ @Override
+ public void execute() {
+ int offsetTop = measureRowHeightOffset(firstvisible);
+ scrollBodyPanel.setScrollPosition(offsetTop);
+ }
+ };
+
/** For internal use only. May be removed or replaced in the future. */
public void updateFirstVisibleAndScrollIfNeeded(UIDL uidl) {
firstvisible = uidl.hasVariable("firstvisible") ? uidl
@@ -1105,8 +1113,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
if (firstvisible != lastRequestedFirstvisible && scrollBody != null) {
// received 'surprising' firstvisible from server: scroll there
firstRowInViewPort = firstvisible;
- scrollBodyPanel
- .setScrollPosition(measureRowHeightOffset(firstvisible));
+
+ /*
+ * Schedule the scrolling to be executed last so no updates to the rows
+ * affect scrolling measurements.
+ */
+ Scheduler.get().scheduleFinally(lazyScroller);
}
}