locked
How to cache the listview content and scrollbar location?

    Question

  • Scenario:

    1. The home page has a listview which auto loading data by WinJS.xhr when scorll bar reach the bottom.

    2. When I click an item in the listview, app navigates to the detail page. 

    3. When I click back button,  app navigates back to the home page without loading content by WinJS.xhr again. 

    My Question is :

    1. How to listen the scroll event of listview?

    2. How to cache the listview state? I've tried to use Application Cache API, but it failed because of Warning DOM7011 which indicates that the code disabled back and forward caching. Has anyone been able to figure a solution? Thanks. 

    Friday, November 08, 2013 3:00 AM

Answers

  • Without seeing how your code works it's really difficult to give you a definitive answer.  However, when you run a new xhr request, you should record an application-level variable that says how much data is loaded in total.  When you revert back to that page, have the xhr automatically reload everything up to the level in the variable. 


    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, November 08, 2013 8:28 PM
    Moderator