-
13 Apr 2012 7:20 AM #1
Create a (global) basic function
Create a (global) basic function
Hello,
How can I create through the designer a basic function that can be instantiated from anywhere;
I can not drop the behaviour basic function over the Application.
I was expecting invoking from different controllers a "global" function.
Thank youCode:Ext.app.fnEnableMenu(sParams); or myApp.fnEnableMenu(sParams);
-
13 Apr 2012 9:49 AM #2Aaron Conran
@aconran
Sencha Architect Development Team
-
15 Apr 2012 10:52 PM #3
Thank you; I already read that thread.
At this stage, it is not possible to add a fn through the designer at the Application level ?
When I give a try to the code solution.
But I get
I invoke the a Fn located in a ControllerCode:Uncaught TypeError: Object [object Object] has no method 'fnEnableMenu'
from another ControllerCode:Ext.define('GrantCycle.controller.c_fp_auth', { extend: 'Ext.app.Controller', ... } , fnEnableMenu: function(sRights) { //console.log(sRights); if (sRights.indexOf('ADM') != -1) { ...
I tried, without successCode:Ext.define('GrantCycle.controller.c_p_adm_users', { extend: 'Ext.app.Controller', ... , Click_b_s_f_adm_user_manage: function(button, e, options) { Ext.getCmp('p_adm_users_fp').getForm().submit({ method: 'POST', scope: this, url: '_cfm/set/update_user.cfm?loc_useralias=' + loc_useralias, waitTitle: 'Connecting', waitMsg: 'Sending data...', clientValidation: true, success: function(){ Ext.getCmp('t_adm_user_manage_quickfilter').fireEvent('keyup'); this.application.fnEnableMenu(); Ext.defer(function() { Ext.Msg.show({ title: 'Form Submitted', msg: 'Success', width: 400, buttons: Ext.MessageBox.OK, icon: Ext.MessageBox.INFO, maxWidth: 400 }); }, 100); } ...
Code:GrantCycle.controller.c_fp_auth.application.fnEnableMenu();
-
16 Apr 2012 10:00 AM #4
hrmmm you added it to the controller, not to the application.
You can invoke it like so:
Code:this.getController('c_fp_path).fnEnableMenu();Aaron Conran
@aconran
Sencha Architect Development Team
-
16 Apr 2012 11:52 PM #5
Thank you.
I will give a try to your solution.
Byt the way, yes, I would prefer put "global" function at the application level and not within a controller but I can not add (through the Designer) the "Application Action" outside a controller? Do I have to create a controller that would contains all my "global" functions? I was expecting dropping the "Application Action" on the Application root node of the project inspector so the function would be created below the Launch default function.
Or I miss something...
Thank you for your time and support,
Jean-Philippe


Reply With Quote