locked
How to keep the list status?

    Question

  • 

    Scenario:

    Home.html contains a listview with data loaded by WinJS.xhr. Each item in the listview has a click event handle which navigates to another page. 

    When user is  back to home.html, data in listview and scrollbar position should not be initialized.

    How to figure it out?

    Thanks.

    Friday, November 15, 2013 12:55 AM

Answers

  • Short answer is that scrollPosition of the list view needs to be saved and restored as session state. For more detailed answer and code, you can refer here.

    -sushil

    Friday, November 15, 2013 8:21 AM

All replies

  • Short answer is that scrollPosition of the list view needs to be saved and restored as session state. For more detailed answer and code, you can refer here.

    -sushil

    Friday, November 15, 2013 8:21 AM
  • Thank you for your reply. It's really helpful. I've solved this by using your method with single page navigation model. The new problem is, the page will lost its' original style when  navigating back, such as the height of the listview(precent). What's more, if A.html which references ui-dark.css navigates to B.html which references ui-light.css, then navigates back to A.html, ui-dark.css doesn't work. Do you have some ideas?
    Monday, November 18, 2013 8:09 AM
  • sorry for the delay. I did not get the alert. In one app - you can only use either ui-dark.css or ui-light.css because of single page navigation model. Also - it is recommended for the app to use one style consistently - light or dark.

    Regarding back navigation issue - it is very likely that two of your .css files have common css selectors. Hence, the styling is getting impact on back navigation. It is best to ensure that all css rules have unique css selectors when needed. This post might help.


    -sushil

    Monday, December 2, 2013 4:19 PM