PDA

View Full Version : Sencha Touch 2.1.0 Beta 2 inheritance question



gkatz
16 Aug 2012, 2:12 AM
switching my simple app to 2.1.0 b2 seem to break the inheritance feature my app is built on.
simply put. I have 2 classes: a,b & c. b extends a and c extends b
when instantiating an instance of class c, the resize listener, that is defined in a, is called. so far so good. within that resize listener code in class a, there is a call to another function (called resizeFunc) that is defined also on class a, yet sencha screams that it does not exist:



Uncaught TypeError: Object [object Object] has no method 'resizeFunc'

Ext.define.config.listeners.resize
Ext.define.doFire
Ext.define.fire


note that that same code works perfectly on 2.0.1.1
is this a know issue? its like the config on class a (listener etc) propagated through the inheritance but the functions didn't. can someone maybe point me in some direction? it will be hard for me to post the code...
thanks.

mitchellsimoens
18 Aug 2012, 9:07 AM
This works for me but may be too simplistic:


Ext.define('a', {
resizeFunc : function() {
console.log('I am here!');
}
});

Ext.define('b', {
extend : 'a'
});

Ext.define('c', {
extend : 'b'
});

new c().resizeFunc();

gkatz
18 Aug 2012, 10:31 PM
thanks;
the only difference I see between my code and your striped down version is that my func is called from a listener on class a.


...
listeners: {
resize: function( thisComp, eOpts ){
this.resizeFunc();
}
}
...

is it possible that something is broken such that the listeners config calling scope went wrong with respect to inheritance in 2.1?
I will try to post something maybe in sencha try if I can. I thought maybe you guys already encountered such a problem
thanks in advance.