2010-12-06 7 views
0

Ext.extend 메소드를 사용하여 확장 된 ExtJS 구성 요소 (Window, DataView 등)가 거의 없습니다. 확장 기능에 몇 가지 추가 속성을 추가하고 싶습니다. 이러한 구성 요소를 구성 요소에 어떻게 추가합니까?사용자 정의 ExtJs 구성 요소의 사용자 정의 특성

ExWindow = Ext.extend(Ext.Window,{ 
border:false, 
initComponent: function() {  

    // Component Configuration... 
    var config = { 
     height: 500, 
     width: 500, 
     items: [{ 
      xtype: 'simplepanel' 
     }] 
    }; 

    Ext.apply(this, Ext.apply(this.initialConfig, config)); 
    ExWindow.superclass.initComponent.apply(this, arguments);  

}, 
onRender:function() { 
    ExWindow.superclass.onRender.apply(this, arguments); 
} 
}); 
+1

일부 코드를 포함하지 않는 한 onRender 재정의를 포함 할 필요가 없습니다. –

답변

0
ExWindow = Ext.extend(Ext.Window,{ 
border:false, 
newPublicProperty: 0, 
newPublicArray: new Array(), 
initComponent: function() {  

    // Component Configuration... 
    var config = { 
     height: 500, 
     width: 500, 
     items: [{ 
      xtype: 'simplepanel' 
     }] 
    }; 

    Ext.apply(this, Ext.apply(this.initialConfig, config)); 
    ExWindow.superclass.initComponent.apply(this, arguments);  

}, 
onRender:function() { 
    ExWindow.superclass.onRender.apply(this, arguments); 
}, 
newPublicMethod:function() { 
} 
}); 

newPublicProperty, newPublicArray, newPublicMethod - 객체의 새로운 추가 속성.

+0

불행히도, 속성 또는 메서드에 액세스 할 수 없습니다. win.newPublicMethod가 방화 광에서 작동하지 않습니다! –

+0

var win = new ExWindow(); win.newPublicMethod(); 그러나 Ext.Window에 새 속성을 추가하려는 경우 - 다른 질문입니다. –

+0

여기에 무엇입니까 : var win = new ExWindow(); 경고 (win.newPublicProperty); ->하지만 그것은 정의되지 않은 말한다! –

관련 문제