diff options
author | Henri Sara <hesara@vaadin.com> | 2013-01-04 08:11:56 +0000 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-01-04 08:11:56 +0000 |
commit | a0b0daa16f52e33fe07567fe87920eb660eb786c (patch) | |
tree | 8be35337cd59d3359c91000df484a1e1346fb135 /client/src | |
parent | 26ef9666577a625aa91669136b47c1c1c9787ce0 (diff) | |
parent | d192085619bcb20a79cedab6f874525bdab68b90 (diff) | |
download | vaadin-framework-a0b0daa16f52e33fe07567fe87920eb660eb786c.tar.gz vaadin-framework-a0b0daa16f52e33fe07567fe87920eb660eb786c.zip |
Merge "Preserve scroll position of ListSelect after server round-trip if the contents haven't changed (#10416)"
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/com/vaadin/client/ui/VListSelect.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/client/src/com/vaadin/client/ui/VListSelect.java b/client/src/com/vaadin/client/ui/VListSelect.java index 2215906af6..5fab520883 100644 --- a/client/src/com/vaadin/client/ui/VListSelect.java +++ b/client/src/com/vaadin/client/ui/VListSelect.java @@ -67,6 +67,8 @@ public class VListSelect extends VOptionGroupBase { @Override public void buildOptions(UIDL uidl) { + int scrollTop = select.getElement().getScrollTop(); + int rowCount = getRows(); select.setMultipleSelect(isMultiselect()); select.clear(); if (!isMultiselect() && isNullSelectionAllowed() @@ -87,6 +89,12 @@ public class VListSelect extends VOptionGroupBase { if (getRows() > 0) { select.setVisibleItemCount(getRows()); } + // FIXME: temporary hack for preserving the scroll state when the + // contents haven't been changed obviously. This should be dealt with in + // the rewrite. + if (rowCount == getRows()) { + select.getElement().setScrollTop(scrollTop); + } } @Override |