Retain scroll position (on re-opening)

2 posts, 0 answers
  1. Wolfgang Kamir
    Wolfgang Kamir avatar
    80 posts
    Member since:
    Jul 2006

    Posted 21 Jul 2010 Link to this post

    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

  2. Wolfgang Kamir
    Wolfgang Kamir avatar
    80 posts
    Member since:
    Jul 2006

    Posted 21 Jul 2010 Link to this post

    ... 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'));
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top