PDA

View Full Version : UX Development: Add Controller causes in typeError



Malte123
20 Jan 2014, 5:34 PM
I am developing an UX - and to manage Timing by Events, I need them on Application-Level.

To do this I need to get an Controller on Application-Level, the UX will be implemented by the Main-App. This could be done by



Ext.app.Controller.getController('testController');



Related to this:
http://docs-origin.sencha.com/extjs/4.2.1/#!/api/Ext.app.Controller-method-getController

I should get an new Instance of Ext.app.Controller

But it ends into an error:

TypeError: 'undefined' is not a function (evaluating 'Ext.app.Controller.getController('testController')')

My main JS called app.js:


Ext.Loader.setPath('Ext.ux', 'ext/src/ux');
Ext.application({
controllers: ["Main"],

views: ["Main"],


name: 'UXdevFramework',

autoCreateViewport: true
});




I hoped so much people today - now I need Ideas myself :-)


// do you know: I tryed to make all Last Posted Users "Malte123" ... but I got a "Moderator has to review your Post" ... ... I want to do this and send a Screenshot LOL

StudentDaniel
20 Jan 2014, 5:41 PM
http://docs-origin.sencha.com/extjs/...-getController (http://docs-origin.sencha.com/extjs/4.2.1/#!/api/Ext.app.Controller-method-getController)

is written what undefined meens


Note that this method dependson Application instance and will return undefined when Application is notaccessible.

Malte123
20 Jan 2014, 5:43 PM
is written what undefined means

Yes - but what is the reason the Application isn't accessible ?

StudentDaniel
21 Jan 2014, 6:16 AM
Hope you get help because you helped a lot of people yesterday ... - I have no Idea - sorry :( :-/

I vote you up (knowing you love it B) )

m.dostal
22 Jan 2014, 7:03 AM
Try this:


App.getApplication().getController('Security')

where 'App' is the application namespace and 'Security' is name of controller class (do not use controller id, there is a bug, you have to access controller by its class name)

Malte123
28 Jan 2014, 6:57 PM
Try this:

Code:

App.getApplication().getController('Security')
where 'App' is the application namespace and 'Security' is name of controller class (do not use controller id, there is a bug, you have to access controller by its class name)

I need a solution I can access out of UX.

So if I need to find a way to get Applications name :-)

Ext.application.name

or

Ext.application.getName()

doesn't work :-(

Malte123
28 Jan 2014, 8:45 PM
Based on evants Help - this could be marked as solved:

Solution is:




Ext.app.Application.instance.getController('controllerName');