Return to Snippet

Revision: 40520
at February 3, 2011 03:55 by djbabylon


Initial Code
MyComponent = Ext.extend(Ext.some.component, {
    // Prototype Defaults, can be overridden by user's config object
    propA: 1,
 
    initComponent: function(){
        // Called during component initialization
 
        // Config object has already been applied to 'this' so properties can 
        // be overriden here or new properties (e.g. items, tools, buttons) 
        // can be added, eg:
        Ext.apply(this, {
            propA: 3
        });
 
        // Before parent code
 
        // Call parent (required)
        MyComponent.superclass.initComponent.apply(this, arguments);
 
        // After parent code
        // e.g. install event handlers on rendered component
    },
 
    // Override other inherited methods 
    onRender: function(){
 
        // Before parent code
 
        // Call parent (required)
        MyComponent.superclass.onRender.apply(this, arguments);
 
        // After parent code
 
    }
});
 
// register xtype to allow for lazy initialization
Ext.reg('mycomponentxtype', MyComponent);

Initial URL
http://www.sencha.com/learn/Manual:Component:Extending_Ext_Components

Initial Description


Initial Title
Extjs - Extending Component Template

Initial Tags


Initial Language
JavaScript