1. #1
    Sencha User
    Join Date
    Oct 2011
    Posts
    34
    Vote Rating
    0
    dakamojo is on a distinguished road

      0  

    Default Advanced NavigationView Functionality

    Advanced NavigationView Functionality


    I have three scenarios that I am trying to figure out how to do with the NavigationView.

    1) Push a new view on the stack and make that new view be the root view. Another way to look at this is after pushing the new view, remove the views from the stack below that view. This is used when going through a wizard and the user reaches a point that they can not go back.
    2) Hide the back button on a particular view. This is similar to #1, except the stack is not cleared.
    3) When the user hits back, pop to a specific view.

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    899
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    To make something the new root view you can insert it into the index of zero:

    Code:
    navigationview.insert(0, {
        html : 'I am the new root view'
    });
    To remove all items in the navigation view and make the root view you can use the reset method:

    Code:
    navigationview.reset();
    We usually recommend leaving the navigation bar alone but you can get the back button doing:

    Code:
    var backButton = navigationview.getNavigationBar().getBackButton();
    You should then be able to execute hide() on it.

    Unfortunately Navigation view doesn't support popping to a specific view, it will only pop back one view.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  3. #3
    Sencha User
    Join Date
    Jun 2009
    Location
    Redwood City, CA
    Posts
    197
    Vote Rating
    6
    CaliLuke is on a distinguished road

      0  

    Default


    I was just working on an app that has the same need (two "disconnected" navigation views) and for that purpose the right way to architect your app is to create two navigation views and put them inside a card layout.

    In my case, the structure is as follows:

    MainContainer
    -LoginScreen (NavigationView)
    --LoginForm
    -LoggedInScreen (NavigationView)
    --ListView

    then two more views that get instantiated on demand

    Instructions
    Details (reachable from ListView)

    This creates the "disconnect" you need. Let me know if you need more context, I'll have the source code for this example ready pretty soon.
    --
    Luca Candela
    twitter: @luckymethod

  4. #4
    Sencha User
    Join Date
    Oct 2011
    Posts
    34
    Vote Rating
    0
    dakamojo is on a distinguished road

      0  

    Default


    Thanks, I will consider the idea of a card layout with two navigation views. I have almost the same scenario, login and registration in one navigation view and the actual app in another.

    Although in the actual app I still have the need to pop back to the root view.

  5. #5
    Sencha User
    Join Date
    Jun 2009
    Location
    Redwood City, CA
    Posts
    197
    Vote Rating
    6
    CaliLuke is on a distinguished road

      0  
    --
    Luca Candela
    twitter: @luckymethod

Thread Participants: 2