11 Apr 2012 1:19 PM #1
Calling Application Basic Functions
I have defined an Application Basic Function and added code to it. I see the code in the generated application config file.
However, now I am stumped. How do I call this method. I have inspected the all the variables in the debugger and could not find a way to call that function.
My app is named AdminApp.... tried AdminApp.method(); Ext.app.... does not have any reference to it.
Please let me know what I am missing here.
12 Apr 2012 9:13 AM #2
I see the "MOVE" prefix on this post. Is that a good thing or a bad thing?
Would it be possible to find out where things are moved to?
(I figured out that it was moved to Help & Discussions instead of bugs where I posted it. But still wondering if the move tag could have told me that in the first place). Just some feedback for a future version.
12 Apr 2012 11:03 AM #3
Move just denoted that it was a discussion topic, not a bug.
Touch and Ext have slightly different syntaxes for invoking the method of an Application method since Touch has a newer MVC package. (You can assume that future versions of Ext will be closer to Touch).
The following assumes we have adding a method named "myMethod" to our Application and we are using the default namespace of "MyApp". Change these to be appropriate to your application.
In controllers, you can access the application instance by invoking this.getApplication().
In controllers, you can access the application instance by the property this.application.
Once you have a reference to the application instance you can invoke the method.Aaron Conran
12 Apr 2012 11:13 AM #4
Thanks. I am using Ext and I am not inside a controller. Does that mean that I cannot access this function?
12 Apr 2012 11:15 AM #5
I'd probably do MyApp.app = this; within Application launch. That way you can access it via the global MyApp.app.Aaron Conran
12 Apr 2012 12:08 PM #6