View Full Version : EXTJS Code structure issue

27 Aug 2014, 4:14 AM
Hi all,

I am using Extjs 4.2 for a project, i have some doubts in the approach which is being suggested and what i have used -
I have Controller, Views, store and model etc being used in the project.

I have used listener and events in the view itself and then i have called some functions of controller, and i have read that events should be define in the respective controller of the view itself. i feel comfort while wirting the events in the view itself and the functionality in controller it's just a matter to call a function of controller manually. Please suggest !
we have used controller reference many times for different functions. Is there any approach to get the controller reference at application level so we could access the controller functions from views directly ?
Is this a performance hit to get references of various components by component query many times ?
Is this Ok to call a controller method from another controller ? I know it doesn't make sense but from sepration prospective i need to split out the controllers functionality. Again is this performance hit ?

Please disucss and suggest !! Any help is appreciated.


27 Aug 2014, 6:33 AM
You could bind the view to the events within the controller such as

init: function() {
Test.util.DataLoad.loadRegions(); this.control({ 'simpleForm' : { boxready : this.boxReady } });

Instead of putting all the logic in controllers, put the common logic in a set of static utils: like the following:

Ext.define('Test.util.DataLoad', {
statics: {

loadRegions : function( ){

put the common logic here.



performance is going to be unknown with the information provided, time will tell you that.
You could call controller to controller using listeners, but you might be better suited for using static libraries.