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

Maintain Scroll Position?

3 Answers 83 Views
General Discussion
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Dave
Top achievements
Rank 1
Dave asked on 17 Sep 2014, 01:59 PM
I have a view on the main page of our Telerik Platform application with a list of RSS feeds.  The view contains over 70 feeds, so you can scroll down quite a bit to view all of the feeds.  When you click into a feed, you navigate to a new view that shows all of the posts for that feed.

I have a backbutton at the top of the feed items view to go back to the homepage.  When clicked it does go back to the original view, but it doesn't maintain the scroll position they were at.  So if they had scrolled all the way to the bottom, then now have to scroll all the way to the bottom again to pick up where they left off.

Anyone dealt with anything like this and have a solution?  I didn't see anything in the documentation, so I'm not sure that it's baked right in to the product?  I've done something similar on the web where we trap for the position on click, then put that somewhere, then we can set the scroll y position when we come back, but was hoping to avoid that much overkill just to try and maintain where they were.

3 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 22 Sep 2014, 08:02 AM
Hello Dave,

I will post here the same information I sent as a reply in your support ticket. We need more information about the implementation of the described scenario in order to advise you how to keep the scroll position.

However, generally if you're using Kendo UI Mobile widgets, such as the ListView, you need to have in mind that if the widget is destroyed (reinitialized), it cannot keep its scroll position.

Regards,
Tina Stancheva
Telerik
 

Visit the Telerik Verified Plugins Marketplace and get the custom Cordova plugin you need, already tweaked to work seamlessly with AppBuilder.

 
0
Dave
Top achievements
Rank 1
answered on 25 Sep 2014, 04:24 PM
I am using a listview and I have the data-role attribute setting it up.  Is that going to reinitialize every time the view is displayed?  If so then I probably need to initialize it manually in the javascript?

<div id="drawer-home" data-role="view" data-layout="drawer-layout" data-title="Plug-N-Run News"
        data-model="app.pnrfeedsService.viewModel" data-show="FeedsShow" autobind="false">
       <header data-role="header">
           <div data-role="navbar">
               <span data-role="view-title"></span>
               <a data-role="button" data-rel="drawer" href="#my-drawer" data-icon="drawer-button" data-align="left"></a>
           </div>
       </header>
       
       <ul data-role="listview" data-style="inset" data-selectable="single" id="ulFeeds"
           data-bind="source: pnrfeedsDataSource"
           data-template="pnr-feeds-template"></ul>
   </div>
 
   <script id="pnr-feeds-template" type="text/x-kendo-tmpl">
       <div style="padding-left: 8px; padding-right: 8px;">
           <a href="views/feeditems.html?FeedId=#:FeedId#" class="km-listview-link" data-role="listview-link">
               <img src="styles/icons/${ImageName}" />
               <h5>${FeedName}</h5>
           </a>
       </div>
   </script>
0
Kiril Nikolov
Telerik team
answered on 30 Sep 2014, 07:43 AM
Hi Dave,

Would you please provide a runnable sample where the issue is reproduced, so we can take a look. The same issue cannot be reproduced in our online demos, so we are not able to tell you what exactly is wrong in your project.

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
General Discussion
Asked by
Dave
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Dave
Top achievements
Rank 1
Kiril Nikolov
Telerik team
Share this question
or