Scroll to item in ListView (Mobile) with endlessScroll

4 posts, 1 answers
  1. Nicola
    Nicola avatar
    15 posts
    Member since:
    Feb 2014

    Posted 20 Sep 2014 Link to this post

    For a navigation menu like iPhone alphabet -scroller on contact's list, I need to scroll the listview down to a particular item. The alphabet-scroller scroll down through the list of contacts depending on which letter is selected with the finger.
    Since with endlessScroll the paging is virtual, they are displayed only some of the #pagesize items loaded by the datasource. I calculate the correct page of the datasource to read based on the count of items for each letter (ex. with a pagesize of 50 item, the 121st item is on page 3) . The problem is that I have to scroll through the listview in order to position the first name with the chosen letter in the  the first line. I've tried using scrollTo and it works but only for items that are actually on the html page. Indeed, the other item (up to the PageSize) are insert on the page only when the listview scroll down. I can't use a filter, because I can't scroll forward and back using directly the listview.
    Is there a scrollToItem solution ? Or how can I say programmatically to the list that I'm scrolling  and that it should display the following items ?

    Thanks !
    Nicola
  2. Answer
    Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 22 Sep 2014 Link to this post

    Hi Nicola,

    The scrollTo() method will not work for items that are not loaded in the DOM. And this behavior is in some way expected - cannot scroll to an element that does not exists. I am afraid that currently there is no workaround that I can offer to you. If you do not have a large data subset, then you can just turn off the virtualization and use the scrollTo() method freely.

    Regards,
    Kiril Nikolov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Nicola
    Nicola avatar
    15 posts
    Member since:
    Feb 2014

    Posted 22 Sep 2014 in reply to Kiril Nikolov Link to this post

    Hi Kiril,
    thanks for now, I will search an alternatite solution for navigation.

    Regards,
    Nicola
  4. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2565 posts

    Posted 22 Sep 2014 Link to this post

    Hi Nicola,

    In case you have any other questions, please do not hesitate to contact us.

    Regards,
    Kiril Nikolov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top