-
23 Feb 2012 6:51 PM #11
Aaron,
I have the same problem, let say that you define a basic function in the aplicación, it ask you in the component config 2 things: fn and param
Then in the code of thet function you put what is the function and if you see the code will be like this:
So you have the function mensaje defined in your app,Code:Ext.Loader.setConfig({ enabled: true }); Ext.application({ views: [ 'MyPanel' ], autoCreateViewport: true, name: 'MyApp', launch: function() { }, mensaje: function(texto, texto2) { function mensaje (texto,texto2) {console.log(texto+" "+texto2)}; } });
The question is how you can call your function?
Thanks
-
21 Mar 2012 8:43 AM #12
Same issue
Same issue
Hi all,
I have the same problem, have you found solution how to call function defined in App ?
Thanks ahead
-
22 Mar 2012 9:17 AM #13
calling user-defined functions
calling user-defined functions
I'm about 3 days into trying out Sencha. Here's how I got around it.
In the application's launch function, I defined a function like so:
And from somewhere else in my code, I called it like so: (where 'TestLogin' is the name of my application)Code:TestLogin.basicFunc = function(cookieName) { alert(cookieName); };
Code:TestLogin.basicFunc("kablooey");
-
22 May 2012 4:17 AM #14
If you are not in the same class, how to do that?
For example, to call a controller's function that is in another controller's function, how to achieve it?
-
22 May 2012 4:21 AM #15
This is hard coding Sencha, it's mean to be used in another way. Isn't it, Sencha Pro?
You define a function as a global function (application scope). It's generally not recommended.Code:TestLogin.basicFunc = function(cookieName) { alert(cookieName); };
If you do that with hundreds of function, it's absolutely bad optimized. Memory is crucial in JS!
-
22 May 2012 4:51 AM #16
UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!
-
22 May 2012 5:06 AM #17
Tried with,
Where MyController is my controller's userClassName, myFunction() is a basic function in this controller. This code snippet runs in a view on a button's handler.Code:this.getController("MyController").myFunction();
..but it doesn't work!
Error: this.getController("MyController") fails
-
22 May 2012 6:40 AM #18
What you mean?This code snippet runs in a view on a button's handler.
"basic function" is in the controller or in the component?
If later be sure that wont work, getController() is a Controller class method.UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!
-
22 May 2012 6:53 AM #19
Basic functions doesn't exist in component in Sencha Architect. My basic function is in the controller.
-
22 May 2012 7:01 AM #20
UI: Sencha Architect 2.x / ExtJS 4 MVC
Server side: EJB 3.1 / CDI / JPA 2 / JAX-RS / JasperReports
Application Server: Glassfish 3.1.x
Databases: Oracle 10g & 11g / DB2 9 & 10 / Firebird 2.5
If you like my answer please vote!


Reply With Quote
