-
16 Feb 2012 5:46 PM #1
Answered: Can I remove all items in a Navigation View?
Answered: Can I remove all items in a Navigation View?
Can I remove all items in a Navigation View? I'd like to remove the "root" card and replace it with another one.
I've tried using reset() and pop(number of items), but they both leave the first item there.
If I use removeAll(), it seems to work. But then when I add() another item, I get an error in Chrome 17 and Firefox 10):
Here's my sample code. It will add a card, add another, remove all cards, then try to add another.sencha-touch-all-debug.js:12583 Uncaught TypeError: Cannot read property 'style' of undefined
(Also, in Chrome and Firefox, the navigation bar looks wrong. But that's a separate issue.)Code:Ext.setup({onReady: function() { var view = Ext.create('Ext.navigation.View', { fullscreen: true, layout: { animation: false } }); Ext.defer(function() { view.push({ title: 'First' }); Ext.defer(function() { view.push({ title: 'Second' }); Ext.defer(function() { view.removeAll(); Ext.defer(function() { view.push({ title: 'Third' }); }, 1000); }, 1000); }, 1000); }, 1000); }});
-
Best Answer Posted by mitchellsimoens
The navigation view is meant to have the same initial card. You could add and remove components from the initial card.
-
17 Feb 2012 6:28 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,581
- Vote Rating
- 433
- Answers
- 3100
The navigation view is meant to have the same initial card. You could add and remove components from the initial card.
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 Feb 2012 3:22 PM #3
Thanks. You might want to clarify this in the documentation. For example, the reset() method says "Resets the view by removing all items between the first and last item", which is kind of confusing.
Would it be difficult to allow the first item to be removed, leaving no inner items? It seems like this would make it more consistent with other components. Plus you can already create it with no inner items.
-
19 Feb 2013 6:22 PM #4
Hi,
I can remove all inner items from a navigation view, however the Back button is still showing.
Can we remove all from navigation view and reset the inner counter so the back button is not shown.
Thanks


Reply With Quote