Dhugal
27 Sep 2012, 3:41 AM
Hi All,
I am creating a new project using Ext 4.1 and attempting to use the MVC architecture however I have hit an issue in that the behaviour I am getting does not match the documentation.
Specifically I am using the following code:
Ext.application({
name: 'MyApp',
appFolder: 'Scripts/App',
launch: function () {
alert(MyApp);
}
});
The code throws an error on the alert call because MyApp has not been created. I have also tried this outside of the launch function (in Chromes console) and the object has not been created after the Ext.application has finished initialising.
What I am expecting is the call to Ext.application to create a global variable, in this case named "MyApp", as detailed in the documentation here:
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.app.Application
(http://docs.sencha.com/ext-js/4-0/#/guide/application_architecture)
Which when referring to this method states:
This does several things. First it creates a global variable called 'MyApp' - all of your Application's classes (such as its Models, Views and Controllers) will reside under this single namespace, which drastically lowers the chances of colliding global variables.
So I should subsequently be able to use code as follows to address the application elsewhere:
MyApp.getApplication()
So right now I am stuck because I don't have any way to address the application object.
Can anyone point out what's going on here please?
I am creating a new project using Ext 4.1 and attempting to use the MVC architecture however I have hit an issue in that the behaviour I am getting does not match the documentation.
Specifically I am using the following code:
Ext.application({
name: 'MyApp',
appFolder: 'Scripts/App',
launch: function () {
alert(MyApp);
}
});
The code throws an error on the alert call because MyApp has not been created. I have also tried this outside of the launch function (in Chromes console) and the object has not been created after the Ext.application has finished initialising.
What I am expecting is the call to Ext.application to create a global variable, in this case named "MyApp", as detailed in the documentation here:
http://docs.sencha.com/ext-js/4-0/#!/api/Ext.app.Application
(http://docs.sencha.com/ext-js/4-0/#/guide/application_architecture)
Which when referring to this method states:
This does several things. First it creates a global variable called 'MyApp' - all of your Application's classes (such as its Models, Views and Controllers) will reside under this single namespace, which drastically lowers the chances of colliding global variables.
So I should subsequently be able to use code as follows to address the application elsewhere:
MyApp.getApplication()
So right now I am stuck because I don't have any way to address the application object.
Can anyone point out what's going on here please?