I am writing a simple Sencha Touch 2 application with the new MVC Framework template, so there are models, shops, controllers and views, and they are all connected with the application.
Now it is possible to use "this.getApplication ()" to get an instance of this super-tuber-class "Application".
And now the problem arises - getApplication () returns only the instance application, if I'm in the controller - in the view, model or storage, it returns "undefined".
Basically, I can understand the idea of ββthis behavior - your business should be in controllers, nowhere else ... and therefore you do not need to know the instance application in such things as shops, presentations or models ...
Okey, but .. it would be very nice to have global properties living in the main application.
For example, I want to define my webservice-url globally in the application and use this variable wherever I need, and, unfortunately, I also need this url in the store.
Now, the only way to access this global variable in the repository is through my namespace. Instead of using "this.getApplication (). ServiceUrl" I only found a solution through the namespace with "NameOfMyApp.app.serviceUrl" - and this could not be the best way to solve this problem.
Any ideas on this issue? Is there a better, always working way to get an application instance from outside? Or, where should I store global variables, if not in the application?