summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authorJarno Rantala <jarno.rantala@vaadin.com>2014-01-03 14:39:58 +0200
committerVaadin Code Review <review@vaadin.com>2014-01-09 06:04:26 +0000
commit407bdb39f7d87acaf15c399e46baf6d6a858fa6d (patch)
tree809d8f1e39bc4ca39e813e19ddd0b8069afe89cc /client
parente41a2cef9b50d3a63b6bffa0f7777c61f5093492 (diff)
downloadvaadin-framework-407bdb39f7d87acaf15c399e46baf6d6a858fa6d.tar.gz
vaadin-framework-407bdb39f7d87acaf15c399e46baf6d6a858fa6d.zip
Ignores scroll events while update from server is in progress (#11454)
When ItemSetChange event occurs, it will recreate the rows in client side. This will mess up the scroll position in scrollBodyPanel when its content is removed. This why the onScroll events should be ignored until the scroll position is reset by lazyScroller. Change-Id: Ib70e0dd7b730d4745a84742509145658e35d517e
Diffstat (limited to 'client')
-rw-r--r--client/src/com/vaadin/client/ui/VScrollTable.java38
1 files changed, 36 insertions, 2 deletions
diff --git a/client/src/com/vaadin/client/ui/VScrollTable.java b/client/src/com/vaadin/client/ui/VScrollTable.java
index c56a2a8772..bb431bf132 100644
--- a/client/src/com/vaadin/client/ui/VScrollTable.java
+++ b/client/src/com/vaadin/client/ui/VScrollTable.java
@@ -991,6 +991,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
if (scrollBody != null) {
scrollBody.removeFromParent();
}
+
+ // Without this call the scroll position is messed up in IE even after
+ // the lazy scroller has set the scroll position to the first visible
+ // item
+ scrollBodyPanel.getScrollPosition();
+
scrollBody = createScrollBody();
scrollBody.renderInitialRows(rowData, uidl.getIntAttribute("firstrow"),
@@ -1121,7 +1127,28 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
}
}
+ private boolean lazyScrollerIsActive;
+
+ private void disableLazyScroller() {
+ lazyScrollerIsActive = false;
+ scrollBodyPanel.getElement().getStyle().clearOverflowX();
+ scrollBodyPanel.getElement().getStyle().clearOverflowY();
+ }
+
+ private void enableLazyScroller() {
+ Scheduler.get().scheduleDeferred(lazyScroller);
+ lazyScrollerIsActive = true;
+ // prevent scrolling to jump in IE11
+ scrollBodyPanel.getElement().getStyle().setOverflowX(Overflow.HIDDEN);
+ scrollBodyPanel.getElement().getStyle().setOverflowY(Overflow.HIDDEN);
+ }
+
+ private boolean isLazyScrollerActive() {
+ return lazyScrollerIsActive;
+ }
+
private ScheduledCommand lazyScroller = new ScheduledCommand() {
+
@Override
public void execute() {
if (firstvisible > 0) {
@@ -1134,6 +1161,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
.setScrollPosition(measureRowHeightOffset(firstvisible));
}
}
+ disableLazyScroller();
}
};
@@ -1152,7 +1180,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
// 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);
+ enableLazyScroller();
}
}
@@ -2172,7 +2200,7 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
isNewBody = false;
if (firstvisible > 0) {
- Scheduler.get().scheduleDeferred(lazyScroller);
+ enableLazyScroller();
}
if (enabled) {
@@ -6871,6 +6899,12 @@ public class VScrollTable extends FlowPanel implements HasWidgets,
@Override
public void onScroll(ScrollEvent event) {
+ // Do not handle scroll events while there is scroll initiated from
+ // server side which is not yet executed (#11454)
+ if (isLazyScrollerActive()) {
+ return;
+ }
+
scrollLeft = scrollBodyPanel.getElement().getScrollLeft();
scrollTop = scrollBodyPanel.getScrollPosition();
/*