PDA

View Full Version : defaultTarget, defaultUrl VS Ext.dispatch to controller (MVC)



won.rhee
6 Jul 2011, 1:40 PM
Hello all,

I am looking at MVC structure and wondering what the difference is between Ext.dispatch VS defaultTarget/defaultUrl in app.js

1) Whether I use Ext.dispatch or defaultUrl, both invoke controller action just fine. Why use one or the other? Does it matter?
2) If I use defaultUrl, do I have to set defaultTarget? It doesn't seem like setting defaultTarget:'viewport' does anything.


Ext.regApplication('MyApp', {
name : 'MyApp',
useLoadMask : true,
phoneStartupScreen : 'LOGO.png',
icon : 'LOGO.png',
glossOnIcon : false,

defaultTarget : "viewport", //WHY USE THESE?
defaultUrl : 'Main/index', // WHEN EXT.DISPATCH DOES THE SAME THING
useHistory : true, // ???

launch: function() {
//console.dir(this);
this.views.viewport = new MyApp.views.Viewport({
application: this
});

// Ext.dispatch({
// controller : 'Main',
// action : 'index'
// });
}
});