View Full Version : navigation controller (along w/ mvc setup)

2 Aug 2011, 7:20 PM
Hey, I just had an idea of how to build a flexible, stack-based navigation controller ( la UINavigationController) with a minimal amount of code. This is not so much of a production example, but rather a dev experiment I hacked up last night. Though there's the NestedList component, I was somehow missing a similar container for generic Panels.

The approach makes use of 2 specialized routes:
map.connect('navigation/push/:_controller/:_action', ...) and
map.connect('navigation/pop/', ...)

and a new type of controller, the 'navigation' controller, that maintains a history of 'pushes' and is able to rewind these. The controller only has 2 actions: push and pop. It enables you to write simple '<a href="#navigation/push/details-controller/index">Details view</a>' links as well as for example 'Ext.redirect("navigation/pop")' statements (i.e. useful for back buttons) and determine whether the new active item is pushed on top (do a slide animation right-to-left) or pop'ped from it (slide the view out left-to-right).

Hope you like it. ;) Try an example and fork the code at https://github.com/pmeinhardt/sencha-touch-mvc

6 Aug 2011, 2:52 AM
Now with more view goodness (xtypes: 'navigationbar', 'backbutton')
concise. provide the expected default behavior. configurable.