我的經驗ExtJS的開發Web應用程序幾個月。我就遇到了這個問題:重寫ExtJS的類和調用callParent
當我重寫一個類,我修改的方法和遵循以前的實現和調用callParent()
。最重要的部分工作,但callParent()
調用舊的實現。
我壓倒一切的代碼
Ext.override(Ext.layout.component.Draw, {
finishedLayout: function (ownerContext) {
console.log("new layouter being overriden");
this.callParent(arguments);
}
});
被覆蓋ExtJS的類方法:
finishedLayout: function (ownerContext) {
var props = ownerContext.props,
paddingInfo = ownerContext.getPaddingInfo();
console.log("old layouter being overriden");
this.owner.setSurfaceSize(props.contentWidth - paddingInfo.width, props.contentHeight - paddingInfo.height);
this.callParent(arguments);
}
在控制檯中,我可以看到,第一個新的座標製圖打印出消息,其次是老座標製圖實現......我把一個斷點,並追溯調用堆棧,新座標製圖的callParent()
叫老之一。我需要調用父類,但不是重寫的方法。
任何想法如何解決這個問題?
對不起,我使用的是,我正在使用ExtJs 4.1.2。選擇的答案是正確的方法,但我無法使用它,而是使用@wantok提供的答案。 – 2013-04-10 01:56:42
順便說一句,繞過您的超級計算機之一,是一個很大的黑客,明智和謹慎使用! – 2013-09-20 18:27:02