Monaca Onsen UI Discord Chat Github Repo

ons-lazy-repeat : how to scroll to a desired list item?



  • I was wondering if there’s any way to scroll the lazy repeat list to the same scrollTop position it was in before calling list.refresh()? The refresh() method scrolls the list back to scrollTop: 0, which I want to avoid.

    Since the items are inserted into DOM dynamically, I can’t simply use the .scrollTop property of the item prior to calling list.refresh() - the item won’t exist in DOM after refresh, and it isn’t possible to scroll down that far.


  • administrators

    The refresh method shouldn’t scroll back to the top of the list. Are you able to reproduce that behaviour in the playground? https://onsen.io/playground/

    You should be able to set it with the normal JS scroll properties but if need be I’ll be post a solution if you can reproduce it