It really causes me problems with Ext Controllers, so today I have a fix, the rixo solution works fine, but there is an alternative to extending each child class. Ext.app.Controller extension instead using the onClassExtended method
/** * Extends Ext.app.Controller with the ability to have refs defined in * Controllers and any of subclasses. * Duplicate refs overwrite each other, last one in class hierarchy wins. */ Ext.define('App.Controller', { extend: 'Ext.app.Controller', //private make refs extensible by any subclasses onClassExtended : function(cls, data, hooks) { var onBeforeClassCreated = hooks.onBeforeCreated; hooks.onBeforeCreated = function(cls, data) { var me = this, name = Ext.getClassName(cls), prototype = cls.prototype, superCls = cls.prototype.superclass, thisRefs = data.refs || [], superRefs = superCls.refs || [], newRefs = [], i = 0; if (thisRefs.length > 0) { for (i=0; i < thisRefs.length; i++) { if (typeof thisRefs[i] !== 'undefined') { newRefs.push(thisRefs[i]); } } } if (superRefs.length > 0) { for (i=0; i < superRefs.length; i++) { if (typeof superRefs[i] !== 'undefined') { newRefs.push(superRefs[i]); } } } data.refs = newRefs; onBeforeClassCreated.call(me, cls, data, hooks); }; } });
source share