-
11 Jan 2012 8:44 AM #1
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
- 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(); }
-
11 Jan 2012 9:10 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 34,121
- Vote Rating
- 453
We will take a look.
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
21 Jan 2012 6:23 PM #3
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.
Success! Looks like we've fixed this one. According to our records the fix was applied for
TOUCH-1367
in
Sprint 14.


Reply With Quote