2017-02-28 1 views
4

클래스를 대상으로 메서드를 병합하는 mixin 클래스가 있습니다. 병합 프로세스가 언제 시작되는지 알고 싶습니다.Extj에서 Mixing 오버라이드

믹스 인 중 하나의 메서드를 재정의했지만 대상 클래스에서 오버로드되지 않았습니다. 그래서 나는 병합이 우선하기 전에 간다고 가정한다.

Ext.define('Ext.container.DockingContainer', 
... 
Ext.define('Ext.panel.Panel', 
... 
Ext.override(Ext.container.DockingContainer 

처음에 ext.js는 mixin을 정의한 다음 대상 클래스를 정의합니다. mixins 메서드를 재정의 할 때 대상 클래스 메서드에 영향을주지 않습니다. 그렇다면이 문제를 어떻게 해결할 수 있을까요? mixins 메서드를 제대로 재정의하는 방법? 나는이 방법으로 그것을 무시했습니다

+0

. 가는대로'DockingContainer'는 그 한 인스턴스에서만 사용되므로 패널 자체를 오버라이드 할 수 있습니다. –

답변

1

: 너무 늦게, 당신은 믹스 인이 적용되기 전에를 오버라이드 (override) 할 필요가있어 그 시점으로

Ext.define('Ext.overrides.container.DockingContainer', 
{  
    override: 'Ext.container.DockingContainer', 
    getDockedItems: function(selector, beforeBody) 
    { 
      .... 
    } 
}, function() { 
     Ext.Object.each(Ext.ClassManager.classes, function(name, cls) { 
      if (cls.prototype && cls.prototype.mixins && cls.prototype.mixins.hasOwnProperty("docking")) { 
       cls.prototype.getDockedItems = this.prototype.getDockedItems; 
      } 
     }, this); 
    } 
); 
관련 문제