简体   繁体   中英

Custom properties for Custom ExtJs components

I have few ExtJS components extended (Window,DataView etc) using Ext.extend method. I would like to add few additional properties to the extended. How do I add these into my component?

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);
}
});
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 - new additional properties of object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM