Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-1367 in a recent build.
  1. #1
    Sencha User
    Join Date
    Sep 2011
    Posts
    19
    Vote Rating
    2
    marcuswu is on a distinguished road

      0  

    Smile Pop to root view for Ext.navigation.View

    Pop to root view for Ext.navigation.View


    This is actually an enhancement request with a reference implementation rather than a bug. I mentioned the solution in a question thread yesterday, so I apologize if I'm being annoying by posting this here as well.

    REQUIRED INFORMATION




    Ext version tested:
    • Sencha Touch 2.0 PR3

    Browser versions tested against:
    • IE8
    • FF3 (firebug 1.3.0.10 installed)
    • Safari 4
    Description:
    • There is no predefined way to pop multiple views from an Ext.navigation.View in one operation.

    Steps to reproduce the problem:
    • Create an Ext.navigation.View
    • Add multiple views to it
    • Try to pop to the top view in one operation

    The result that was expected:
    • Should be able to pop to the root view or to any view in-between directly rather than just one view at a time.

    The result that occurs instead:
    • Under the current code a user would have to press the back button for each view on the navigation view. In some circumstances it could be desired / required to move directly to a specific view on the stack or to the root view.

    Possible fix:
    • The following code is a reference implementation of a pop to root. A similar routine could be developed to pop to a specific view in the stack. I recommend adding something like this to the navigation view implementation -- I think many people would find it useful.
      Code:
          popToRoot: function(destroy)
          {
              var navBar = this.getNavigationBar(),
              stackLn = this.stack.length,
              stackRm;
              
              //just return if we're at root
              if(stackLn <= 1) return;
              //just return if we're already animating
              if(navBar && navBar.animating) return;
              
              //splice the stack to get rid of items between top and root
              stackRm = this.stack.splice(1, stackLn-2);
              //remove views that were removed from the stack if required
              if(destroy) {
                  stackRm.forEach(function(val, idx, arr) {
                      this.remove(val, true);
                  });
              }
              //clear out back button stack
              navBar.backButtonStack = [];
              //now we can do a normal pop
              this.pop();
          }

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,217
    Vote Rating
    859
    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


    We will take a look.
    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 - Sencha Touch Dev Team rdougan's Avatar
    Join Date
    Oct 2008
    Posts
    1,158
    Vote Rating
    6
    rdougan will become famous soon enough

      0  

    Default


    This will be in the next release as a Ext.navigation.View#reset method.
    Sencha Inc.
    Robert Dougan - @rdougan
    Sencha Touch 2 and Ext JS 4 Core Team Member, SASS/Theming Wizard.