locked
appbar and listview doesnot appear when revisiting a page,using single page navigation. RRS feed

  • Question

  • Hi ,

      I have a default.html page which has a fragment to hold home.html or pagetwo.html.

    The appbar shows nice when swiped in home.html. When I navigate away from home.html to pagetwo.html, the appbar is fine and shows up in pagetwo.html.  But when I come back to home.html the appbar doesnot show up even on swipe gesture (from bottom) or right clicked. 

    Also I have dynamic listviews added each time a button was clicked in the appbar of home.html.  Those listviews along with the items also don't appear when I come back into home.html.

    I checked via watch window, the values(of listview items) are still good, even if listview does not show up.

    I checked that the appbar is not disabled. it doesnot show up even if I do appbarcontrol.show();  in the (pages.define )ready function of home.html.

    Any pointers on how to solve this? Thanks so much.

    -Karthika


    karthika

    Sunday, December 30, 2012 6:02 AM

Answers

  • Hi Steven,

    I got the appbar to work. I previously had a command in the appbar(in default.html) and I hided it in pagetwo.hrml fragment. That has caused the problem which stopped the appbar from appearning when revisiting homepage fragment.

    Now I did hidden:"true" in default.html and did showcommands in home.html and hidecommands in pagetwo.html. The appbar is visible now in both the fragment pages.

    Thanks

    Karthi.


    karthika

    • Marked as answer by ArunKarthika Thursday, January 3, 2013 7:42 PM
    Thursday, January 3, 2013 7:42 PM

All replies

  • debug your Navigator.js file whether the url of the file is saved in the navigated event

    Sunday, December 30, 2012 11:01 AM

  • Hi Arun Karthika,

    Are you using the "Navigation App" or "Split App" project template (of visual studio 2012) to build the windows store js application? If so, the built-in navigation framework uses a HTMLControl (page control) as a container of navigation pages used in the application. And you should always use WinJS.Navigation.navigate (or other navigation methods) to switch between different pages. And for the appbar control, we should define it in the default.html page (out-side the page control container) so that all pages (which will be navigated to) in the windows store app can see it.

    As for the dynamically added ListView, I think the windows store runtime (and also the navigation page framework) won't automatically help you maintain its states. That means, after you navigate away from a page (which contains some dynamically added ListView or other controls), when you navigate back, the controls will not exist since the page UI is regenerated from its page template (defined in the .html file) again. You will need to add your own code to maintain states of a certain page so that you can restore the UI layout (and any control states) when user navigate back to the page again.


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, January 1, 2013 2:48 AM
    Moderator
  • HI Steven,

    Thanks. I will code for my dynamic listview each time the page is loaded.

    As far as the appbar is concerned, I am having it in default.html file outside the page control Div. Navigation app template also has the commented appbar like this. Also my navigations are using Winjs.navigation.navigate. Trying to find out whatelse I have done wrong. Any other issues u think of?

    Karthi.


    karthika

    Tuesday, January 1, 2013 5:36 AM
  • Hi Regel,

    Can you explain more on how I do that? Thanks so much.

    Karthi.


    karthika

    Tuesday, January 1, 2013 5:37 AM
  • Hi Steven,

    I got the appbar to work. I previously had a command in the appbar(in default.html) and I hided it in pagetwo.hrml fragment. That has caused the problem which stopped the appbar from appearning when revisiting homepage fragment.

    Now I did hidden:"true" in default.html and did showcommands in home.html and hidecommands in pagetwo.html. The appbar is visible now in both the fragment pages.

    Thanks

    Karthi.


    karthika

    • Marked as answer by ArunKarthika Thursday, January 3, 2013 7:42 PM
    Thursday, January 3, 2013 7:42 PM