javascript - ExtJs 4.2 Access variable from extended Controller -


i have 2 controllers this:

controller 1(main)

ext.define('app.maincontroller', {     extend: 'ext.app.controller',     models:[         //some_models     ],     stores:[         //some_stores     ],     views: [         //some_views     ],     refs: [],     init: function() {         this.tipodetalle='';         this.control({             'gridconcursos':{                 itemdblclick:this.ondblclickrow             }         });     },      //some_code      ondblclickrow:function(element, record, item, index, e, eopts){         this.tipodetalle=record.data['tipo_concurso'];     }      //some_code }); 

controller 2(sub controller)

ext.define('app.subcontroller', {     extend: 'app.maincontroller',     models:[         //some_models     ],     stores:[         //some_stores     ],     views: [         //some_views     ],     refs: [],     init: function() {         this.control({             'fichadetalle':{                 beforeshow:this.onbeforeshow             }         });     },      //some code      onbeforeshow:function(){         //some way print variable tipodetalle main controller     } }); 

on second controller,in function onbeforeshow want print or show variable first controller tipodetalle,but don´t know if possible,and if possible don´t know how variable in second controller

you can use syntax:

<appname>.app.getcontroller(<controller's full name>).<var name> 

in case

app.app.getcontroller('app.maincontroller').tipodetalle

make sure initialize tipodetalle variable in controller below:

ext.define('app.maincontroller', { extend: 'ext.app.controller', tipodetalle:'', ...


Comments