This is a migrated thread and some comments may be shown as answers.

Retain scroll position (on re-opening)

1 Answer 41 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Wolfgang Kamir
Top achievements
Rank 1
Wolfgang Kamir asked on 21 Jul 2010, 07:12 AM
Hello dear Telerikers,

i got a question regarding the scroll position.... The problem is easily reproduced (for example on this demo-page):
RadComboBox Demo

Just go ahead and select any value in any combobox.... it has to be a little down the list, so the vertical scrollbar is moved.

When you now close the dropdown and re-open it, the scrollposition always starts at the very top and only after completely opening the dropdown, scrolling down to the selected item happens. It looks a littly "jumpy" and just not as fine as I would like it to be...

Is there any way around this? (setting the scroll-position on "pre-dropdown" or something)?

Thanks for any suggestion!

Kind regards,
Wolfgang

1 Answer, 1 is accepted

Sort by
0
Wolfgang Kamir
Top achievements
Rank 1
answered on 21 Jul 2010, 12:04 PM
... nevermind, I found a solution:

Type.registerNamespace("MyProject.Helpers.RadComboBox");
  
MyProject.Helpers.RadComboBox.retainScrollPosition = function (radComboBox) {
    radComboBox._slide._origExpand = radComboBox._slide.expand;
    radComboBox._slide._radComboBox = radComboBox;
    radComboBox._slide.expand = function () {
        this._origExpand.call(this);
        var scrollContainer = $(this._radComboBox._dropDownElement).find('div.rcbScroll');
        scrollContainer.scrollTop($(this._radComboBox._selectedItem._element).position().top);
    };
};
  
// call from somewhere:
  
MyProject.Helpers.RadComboBox.retainScrollPosition($find('SomeComboBoxID'));
Tags
ComboBox
Asked by
Wolfgang Kamir
Top achievements
Rank 1
Answers by
Wolfgang Kamir
Top achievements
Rank 1
Share this question
or