I have a few months of experience developing Extjs web application. I ran into this problem:
When I override a class, I modified the method and followed the previous imp
If you're using ExtJS 4.1.3 or later you can use this.callSuper(arguments)
to "skip" the overridden method and call the superclass implementation.
The ExtJS documentation for the method provides this example:
Ext.define('Ext.some.Class', {
method: function () {
console.log('Good');
}
});
Ext.define('Ext.some.DerivedClass', {
method: function () {
console.log('Bad');
// ... logic but with a bug ...
this.callParent();
}
});
Ext.define('App.patches.DerivedClass', {
override: 'Ext.some.DerivedClass',
method: function () {
console.log('Fixed');
// ... logic but with bug fixed ...
this.callSuper();
}
});
And comments:
The patch method cannot use callParent to call the superclass method since that would call the overridden method containing the bug. In other words, the above patch would only produce "Fixed" then "Good" in the console log, whereas, using callParent would produce "Fixed" then "Bad" then "Good"
You can't use callParent
but you can just call the grandparent class method directly instead.
GrandparentClass.prototype.finishedLayout.apply(this, arguments);
Here's a more generic (if somewhat fragile) approach.
this.superclass.superclass[arguments.callee.$name].apply(this, arguments);