Abdel Raoof Olakara
Abdel Raoof Olakara

Reputation: 19353

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);
}
});

Upvotes: 0

Views: 7914

Answers (1)

Andrey Korolyov
Andrey Korolyov

Reputation: 996

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.

Upvotes: 0

Related Questions