PDA

View Full Version : Navigation Control - How To



dijksvi
4 Feb 2012, 12:50 AM
Imagine you have an app that consists of "X" different pages. Would you then implement a TabPanel to manage all of these pages, and have some Navigation controller that activates a specific page based on a particular button click?

I can imagine that you fire events (App.fireEvent('HomePage')) that get caught by the NavigationController that than activates the requested page. Is this a recommend aprroach ?

Any other thoughts ?

Thanks,

Vincent

mitchellsimoens
4 Feb 2012, 6:59 AM
Using TabPanel or just a Container with card layout or whatever is up to you. If you want history support (like if someone presses the back button on the browser) then I would be route oriented. Say someone clicks on a button and you would normally listen for the tap event in the controller and just navigate to the specific item like using setActiveItem. Instead, in the tap event, you would use this.redirectTo('....'); which will change the hash on the url if there is a route defined in the routes config of the config object and will then execute the associated method. The KitchenSink uses routes.