Return to Snippet

Revision: 24490
at June 16, 2010 09:29 by JimBarrows


Updated Code
Ext.namespace('Namespace');
Namespace.AnExtension = Ext.extend(Ext.Panel, {

    //    ,constructor:function(config) {
//        // constructor pre-processing - configure listeners here
//        config = config || {};
//        config.listeners = config.listeners || {};
//        Ext.applyIf(config.listeners, {
//             expand:{scope:this, fn:function() {
//            }}
//            ,collapse:{scope:this, fn:function() {
//            }}
//        });
//
//        
//        Namespace.AnExtension.superclass.constructor.apply(this, arguments);
//
//        // constructor post-processing
//
//    }, 

    initComponent: function() {

        var config = {};

        // apply config
        Ext.apply(this, config);
        Ext.apply(this.initialConfig, config);

        Namespace.AnExtension.superclass.initComponent.apply(this, arguments);

        // after parent code here, e.g. install event handlers
        // this.on('beforerender', function(dis) {
        // alert('before render');
        // });
    }

    ,
    onRender: function() {

        Namespace.AnExtension.superclass.onRender.apply(this, arguments);

    }

    // any other added/overrided methods
});

Ext.reg('Namespace.AnExtension', Namespace.AnExtension);

Revision: 24489
at June 10, 2010 10:37 by JimBarrows


Updated Code
Ext.namespace('Namespace');
Namespace.AnExtension = Ext.extend(Ext.Panel, {

    // uncomment constructor if you need it, e.g. if you need listeners
    // ,constructor:function(config) {
    // // constructor pre-processing - configure listeners here
    // config = config || {};
    // config.listeners = config.listeners || {};
    // Ext.applyIf(config.listeners, {
    // expand:{scope:this, fn:function() {
    // ,collapse:{scope:this, fn:function() {
    // });
    //
    // Namespace.AnExtension.superclass.constructor.apply(this, arguments);
    //
    //
    // }
    initComponent: function() {

        var config = {};

        // apply config
        Ext.apply(this, config);
        Ext.apply(this.initialConfig, config);

        Namespace.AnExtension.superclass.initComponent.apply(this, arguments);

        // after parent code here, e.g. install event handlers
        // this.on('beforerender', function(dis) {
        // alert('before render');
        // });
    }

    ,
    onRender: function() {

        Namespace.AnExtension.superclass.onRender.apply(this, arguments);

    }

    // any other added/overrided methods
});

Ext.reg('Namespace.AnExtension', Namespace.AnExtension);

Revision: 24488
at June 9, 2010 14:41 by JimBarrows


Updated Code
AnExtension = Ext.extend(Ext.Panel, {

    // soft config (can be changed from outside)
    border:false


    // uncomment constructor if you need it, e.g. if you need listeners
//    ,constructor:function(config) {
//        // constructor pre-processing - configure listeners here
//        config = config || {};
//        config.listeners = config.listeners || {};
//        Ext.applyIf(config.listeners, {
//             expand:{scope:this, fn:function() {

//            ,collapse:{scope:this, fn:function() {

//        });
//
//        // call parent contructor
//        AnExtension.superclass.constructor.apply(this, arguments);
//
//        // constructor post-processing
//
//    } // eo function constructor

    ,initComponent:function() {

        // hard coded (cannot be changed from outside)
        var config = {
        };
 
        // apply config
        Ext.apply(this, config);
        Ext.apply(this.initialConfig, config);

        // call parent
        AnExtension.superclass.initComponent.apply(this, arguments);
 
        // after parent code here, e.g. install event handlers
        // this.on('beforerender', function(dis) {
        //		alert('before render');
        //	});
    } // eo function initComponent

    ,onRender:function() {
 
        // before parent code
 
        // call parent
        AnExtension.superclass.onRender.apply(this, arguments);
 
        // after parent code, e.g. install event handlers on rendered components
 
    } // eo function onRender


    // any other added/overrided methods
}); // eo extend
 
// register xtype
Ext.reg('anextension', AnExtension); 
 
// eof

Revision: 24487
at March 2, 2010 15:02 by JimBarrows


Initial Code
AnExtension = Ext.extend(Ext.Panel, {

    // soft config (can be changed from outside)
    border:false
 
    // {{{
    // uncomment constructor if you need it, e.g. if you need listeners
//    ,constructor:function(config) {
//        // constructor pre-processing - configure listeners here
//        config = config || {};
//        config.listeners = config.listeners || {};
//        Ext.applyIf(config.listeners, {
//             expand:{scope:this, fn:function() {
//            }}
//            ,collapse:{scope:this, fn:function() {
//            }}
//        });
//
//        // call parent contructor
//        AnExtension.superclass.constructor.apply(this, arguments);
//
//        // constructor post-processing
//
//    } // eo function constructor
    // }}}
    // {{{
    ,initComponent:function() {
        // {{{
        // hard coded (cannot be changed from outside)
        var config = {
        };
 
        // apply config
        Ext.apply(this, config);
        Ext.apply(this.initialConfig, config);
        // }}}
 
        // call parent
        AnExtension.superclass.initComponent.apply(this, arguments);
 
        // after parent code here, e.g. install event handlers
        // this.on('beforerender', function(dis) {
        //		alert('before render');
        //	});
    } // eo function initComponent
    // }}}
    // {{{
    ,onRender:function() {
 
        // before parent code
 
        // call parent
        AnExtension.superclass.onRender.apply(this, arguments);
 
        // after parent code, e.g. install event handlers on rendered components
 
    } // eo function onRender
    // }}}

    // any other added/overrided methods
}); // eo extend
 
// register xtype
Ext.reg(\'anextension\', AnExtension); 
 
// eof

Initial URL
http://www.extjs.com/learn/Tutorial:Extending_Ext2_Class

Initial Description
This has been heavily modified from the original.

Initial Title
ExtJS Extension

Initial Tags


Initial Language
JavaScript