I am having trouble getting Ext.Router to register changes to the URL. I started my application with the example for model view controller on sencha touch site.
Ext.setup({
tabletStartupScreen: 'tablet_startup.png',
phoneStartupScreen: 'startup.png',
icon: 'icon.png',
onReady: function() {
KOI.views.viewport = new KOI.views.Viewport();
}
});
And I have a routes file, (loaded before app)
Ext.Router.draw(function(map) {
map.connect("main", { controller: 'menu', action: 'index' });
});
This is the controller
KOI.controllers.menus = new Ext.Controller({
index: function(options) {
KOI.views.viewport.setActiveItem(KOI.views.mainMenu);
}
});
Ext.regController('menu', KOI.controllers.menus);
but changing the URL to http://myapp.com/#main does nothing, although the controller does work. Any ideas what I am missing? Any help would be greatly appreciated. There isnt very much documentation for Ext.router and I cant see a good way to debug whats going on.
Ext.setupis equivalent toExt.onReadyand does nothing else but call a callback function when the dom is loaded and accessible.Ext.regApplicationhowever creates a newExt.Application, passing in your config object to it.Part of an
Ext.Applicationis theExt.Application.onBeforeLaunchandExt.Application.launch.onBeforeLaunchsets up history support if you have that enabled, and then callslaunch.If
launchdoesn’t return false thenonBeforeLaunchwill go ahead and callExt.redirectwith either your last history item / token, yourdefaultUrlor if all else fails{controller: 'application', action: 'index'}