summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorJohn Ahlroos <john@vaadin.com>2013-09-19 16:42:50 +0300
committerVaadin Code Review <review@vaadin.com>2013-09-26 05:36:29 +0000
commitd3261d77a45a24edcb4e77370e12c8e88c119d35 (patch)
treeb4d17a998f4cc58d3cbed670c6d09cb4f2c87897 /client
parenta2daf65958c602dd02099bf4415e7e432b706dc7 (diff)
downloadvaadin-framework-d3261d77a45a24edcb4e77370e12c8e88c119d35.tar.gz
vaadin-framework-d3261d77a45a24edcb4e77370e12c8e88c119d35.zip
Fixes issue with Table not scrolling completely to the end #12651
Made the Table notice if the user is trying to scroll to an item on the last "page" and in those cases actually scroll to that item, not just to the page's first item as it did before. Change-Id: I47df33c75aa9b7e4f9a5f4bd5daeb301028517e8
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/VScrollTable.java27
1 files changed, 13 insertions, 14 deletions
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java
index 3733ee204a..492730259a 100644
--- a/client/src/com/vaadin/client/ui/VScrollTable.java
+++ b/client/src/com/vaadin/client/ui/VScrollTable.java
@@ -176,6 +176,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private int firstRowInViewPort = 0;
private int pageLength = 15;
private int lastRequestedFirstvisible = 0; // to detect "serverside scroll"
+ private int firstvisibleOnLastPage = -1; // To detect if the first visible
+ // is on the last page
/** For internal use only. May be removed or replaced in the future. */
public boolean showRowHeaders = false;
@@ -1111,8 +1113,14 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
private ScheduledCommand lazyScroller = new ScheduledCommand() {
@Override
public void execute() {
- int offsetTop = measureRowHeightOffset(firstvisible);
- scrollBodyPanel.setScrollPosition(offsetTop);
+ if (firstvisibleOnLastPage > -1) {
+ scrollBodyPanel
+ .setScrollPosition(measureRowHeightOffset(firstvisibleOnLastPage));
+ } else {
+ scrollBodyPanel
+ .setScrollPosition(measureRowHeightOffset(firstvisible));
+ }
+ firstRowInViewPort = firstvisible;
}
};
@@ -1120,6 +1128,8 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
public void updateFirstVisibleAndScrollIfNeeded(UIDL uidl) {
firstvisible = uidl.hasVariable("firstvisible") ? uidl
.getIntVariable("firstvisible") : 0;
+ firstvisibleOnLastPage = uidl.hasVariable("firstvisibleonlastpage") ? uidl
+ .getIntVariable("firstvisibleonlastpage") : -1;
if (firstvisible != lastRequestedFirstvisible && scrollBody != null) {
// received 'surprising' firstvisible from server: scroll there
firstRowInViewPort = firstvisible;
@@ -2150,18 +2160,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
isNewBody = false;
- if (firstvisible > 0) {
- // Deferred due to some Firefox oddities
- Scheduler.get().scheduleDeferred(new Command() {
-
- @Override
- public void execute() {
- scrollBodyPanel
- .setScrollPosition(measureRowHeightOffset(firstvisible));
- firstRowInViewPort = firstvisible;
- }
- });
- }
+ Scheduler.get().scheduleFinally(lazyScroller);
if (enabled) {
// Do we need cache rows