Looks like we can't reproduce the issue or there's a problem in the test case provided.
-
Ext JS Premium Member
Cannot add additional function for init() function in a controller
init: function() {
this.control({
...
//Designer2.x support coding here now.
});
//But cannot support coding here!
}
-
Go to Code View, in the dropdown at the top left change the controller to init.
Code that you add here will be placed directly after this.control() in the init block.
-
However note that you won't have access to getters and setters in init. 90% of the "initialization code" should be placed in the launch function of your controllers
-
Ext JS Premium Member
Should it be fired when the controller is dynamically loaded
Thanks Phil.Strong
"onLaunch()" in controllers like below 'MonitoringController' will not be fired.
Code:
if (selections && selections.length) {
var monitorCtrl = this.getController('MonitoringController'),
tab = Ext.widget(
'monitoringTab',
{closable: true, title: 'Monitoring - ' + selections[0].data.factory}
);
monitorCtrl.init();
this.getTabPanel().setActiveTab(this.getTabPanel().add(tab));
}
Getter for ref and store works in init().
-
what works and doesn't work depends on version of ST 2 your using. The latest has a launch function (not onLaunch) and ... ref getters and setters aren't ready in init
Code:
launch: function() {
}
-
ExtJS does allow for you to use init function along with controller reference getters/setters. Just to be clear.
Also onLaunch is the correct "launch" function and needs to be added as a basicFunction
fn: 'onLaunch'
-
Ext JS Premium Member
My fault, should be "launch()"
Hi Pil Strong,
launch() in a controller could not be fired automatically when the controller is loaded in this way:
Code:
AnotherController.getController("TheController");
The way to fire launch() is to invoke it directly like below.
Code:
AnotherController.getController("TheController").launch();
Is it right?
As my understanding, your point is launch() should be more safe than init() because getter and setter are prepared in launch() but maybe not in init().
Thanks,
Metas
-
You shouldn't need to call launch. Simply include the controller name in your Ext.Application controllers property like so:
Code:
Ext.application({
name: 'MyApp',
controllers: [
'MyController'
],
launch: function() {
}
});
where controller is:
MyApp.controller.MyController
-
Sencha User
Unable to Edit Launch function
Hi
I am using Sencha Architect Version: 2.2.2 Build: 991,
and I am trying change the Startup application in the Launch Function and not allowed
I also have created (added) lauch function which shows empty initially and when code is added get appended with existing code
Any one found this and any resolution for this problem
Thanks
Dhana
-

Originally Posted by
dhana@urjita.co.in
I also have created (added) lauch function which shows empty initially and when code is added get appended with existing code
Any one found this and any resolution for this problem
This is how it works. If you don't want architect to create the initial view and want to create your own launch code without any help from architect; right click on your initial view and say unmark as initial view.
Whatever is in your launch fn will be what is run with no additions.