locked
Maintain the itemList state after leaving the page

    Question

  • Hello! 

    I have a page with ListView, which is being filled with data from json file. It functions good, except when I leave the page and come back to it - the List is empty again.

    Best regards

    Thursday, August 8, 2013 6:32 AM

Answers

  • Hi jag0,

    While leaving the page, the page will be destoryed by the system, and when visit again, the page re-create. That's why when you back to the page, the list is empty.

    I thought there are two solutions for this question.

    1, While init the page, fetch your json file again and fill the data into the ListView.

    2, Save the data in the local storage while leaving the page and fill in when back, See this tutorial: Quickstart: Local application data (JavaScript)

    Best Regards,


    James He
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by jag0 Friday, August 9, 2013 11:08 AM
    Friday, August 9, 2013 2:18 AM
    Moderator

All replies

  • Hi jag0,

    While leaving the page, the page will be destoryed by the system, and when visit again, the page re-create. That's why when you back to the page, the list is empty.

    I thought there are two solutions for this question.

    1, While init the page, fetch your json file again and fill the data into the ListView.

    2, Save the data in the local storage while leaving the page and fill in when back, See this tutorial: Quickstart: Local application data (JavaScript)

    Best Regards,


    James He
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by jag0 Friday, August 9, 2013 11:08 AM
    Friday, August 9, 2013 2:18 AM
    Moderator
  • Thank you for a quick response! It helped a lot!
    Friday, August 9, 2013 11:08 AM