eilijah
2 Nov 2011, 4:05 PM
Hello,
here my controller :
Ext.define('s2Test.controller.Main', {
extend: 'Ext.app.Controller',
views: [
'Home',
'Tabgroup'
],
init: function() {
this.control({
'#menuButton456': {
// Why this function is executed on the app loading?
tap: this.onMenuButtonTap(),
}
});
Ext.apply( s2Test.views, {
home: this.getHomeView().create(),
tabgroup: this.getTabgroupView().create(),
});
var Ivs = s2Test.views;
s2Test.ideoviewport.add([
Ivs.home,
Ivs.tabgroup
]);
s2Test.ideotoolbar.setItems([{
xtype: 'button',
id: 'menuButton456',
text: 'menu',
ui: 'right'
}]);
s2Test.ideotoolbar.setTitle("Home");
Ivs.home.show();
},
onMenuButtonTap: function () {
alert("tap");
this.application.fireEvent('loadContent');
}
});
The 'alert("tap");' is executed when i launch the application, how is it possible?
There, my full small test app :
- app.js : http://pastebin.com/ggC9ZjSK
- controller/Main.js : http://pastebin.com/C35PLfH8
- controller/TabGroup.js: http://pastebin.com/QmPv6PTf
- view/Home.js: http://pastebin.com/L9gsX3ny
- view/TabGroup.js : http://pastebin.com/tqF9mZ5s
PS: any comment on the code is welcome.
Good night!
here my controller :
Ext.define('s2Test.controller.Main', {
extend: 'Ext.app.Controller',
views: [
'Home',
'Tabgroup'
],
init: function() {
this.control({
'#menuButton456': {
// Why this function is executed on the app loading?
tap: this.onMenuButtonTap(),
}
});
Ext.apply( s2Test.views, {
home: this.getHomeView().create(),
tabgroup: this.getTabgroupView().create(),
});
var Ivs = s2Test.views;
s2Test.ideoviewport.add([
Ivs.home,
Ivs.tabgroup
]);
s2Test.ideotoolbar.setItems([{
xtype: 'button',
id: 'menuButton456',
text: 'menu',
ui: 'right'
}]);
s2Test.ideotoolbar.setTitle("Home");
Ivs.home.show();
},
onMenuButtonTap: function () {
alert("tap");
this.application.fireEvent('loadContent');
}
});
The 'alert("tap");' is executed when i launch the application, how is it possible?
There, my full small test app :
- app.js : http://pastebin.com/ggC9ZjSK
- controller/Main.js : http://pastebin.com/C35PLfH8
- controller/TabGroup.js: http://pastebin.com/QmPv6PTf
- view/Home.js: http://pastebin.com/L9gsX3ny
- view/TabGroup.js : http://pastebin.com/tqF9mZ5s
PS: any comment on the code is welcome.
Good night!