chunkT
29 Nov 2011, 12:04 AM
Hi all,
i try to upgrade to ExtJS 4.* and have figured out that the extend mechanism for classes does not work as aspected when using Ext.extend; I am aware of the fact that this function is deprecated and that i should use Ext.define but i am curios if the following behavior is intentional or not.
Previous to ExtJS 4 i had some classes defined the following way:
MyClass = function(){
console.log('MyClass.constructor');
this.addEvents('dosomething');
MyClass.superclass.constructor.call(this);
};
Ext.extend(MyClass, Ext.util.Observable, {
doSomething : function(){
}
});
new MyClass() //logs MyClass.constructor
//creating a new SubClass from MyClass
MySubClass = Ext.extend(MyClass, {
constructor : function(){
console.log('MySubClass.constructor');
MySubClass.superclass.constructor.call(this);
}
});
new MySubClass()
//logs MySubClass.constructor then MyClass.constructor in Ext < 4
//logs MySubClass.constructor in Ext >= 4
Since ExtJS 4 the constructor of MyClass is not called anymore.
Is this considered a bug or a feature? :]
Best,
chunk
i try to upgrade to ExtJS 4.* and have figured out that the extend mechanism for classes does not work as aspected when using Ext.extend; I am aware of the fact that this function is deprecated and that i should use Ext.define but i am curios if the following behavior is intentional or not.
Previous to ExtJS 4 i had some classes defined the following way:
MyClass = function(){
console.log('MyClass.constructor');
this.addEvents('dosomething');
MyClass.superclass.constructor.call(this);
};
Ext.extend(MyClass, Ext.util.Observable, {
doSomething : function(){
}
});
new MyClass() //logs MyClass.constructor
//creating a new SubClass from MyClass
MySubClass = Ext.extend(MyClass, {
constructor : function(){
console.log('MySubClass.constructor');
MySubClass.superclass.constructor.call(this);
}
});
new MySubClass()
//logs MySubClass.constructor then MyClass.constructor in Ext < 4
//logs MySubClass.constructor in Ext >= 4
Since ExtJS 4 the constructor of MyClass is not called anymore.
Is this considered a bug or a feature? :]
Best,
chunk