Boilerplate file for extension. Copy&paste it to your app then write your functionality in.

Share This Post

Code in this post can be obsolete, however, principles and theory may still apply.
// vim: ts=4:sw=4:nu:fdc=4:nospell
/*global Ext, AnExtension */
/**
 * @class AnExtension
 * @extends Ext.Panel
 *
 * AnExtension description
 *
 * @author    Ing. Jozef Sakáloš
 * @copyright (c) 2010, by Ing. Jozef Sakáloš
 * @date
      *
 
    • 11. March 2010
*
 * @version   1.0
 * @revision  $Id$
 *
 * @license AnExtension.js is released under the 
 * GNU GPL 3.0
 * license. It’s free for use in GPL and GPL compatible open source software, 
 * but if you want to use the component in a commercial software (closed source),
 * you have to get a commercial license.
 */

// create namespace
Ext.ns('AnExtension');

/**
 * Creates new AnExtension
 * @constructor
 * @param {Object} config A config object
 */
AnExtension = Ext.extend(Ext.Panel, {

    // default config (it can be changed while instantiating)
    border:false

    // {{{
    // uncomment constructor if you need it, e.g. if you need listeners
//    ,constructor:function(config) {
//        // parent constructor call pre-processing - configure listeners here
//        config = config || {};
//        config.listeners = config.listeners || {};
//        Ext.applyIf(config.listeners, {
//            // add listeners config here
//        });
//
//        // call parent constructor
//        AnExtension.superclass.constructor.call(this, config);
//
//        // parent constructor call post-processing
//
//    } // eo function constructor
    // }}}
    // {{{
    ,initComponent:function() {

        // hard coded config (it cannot be changed while instantiating)
        // {{{
        var config = {
        }; // eo config object

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

        // call parent
        AnExtension.superclass.initComponent.apply(this, arguments);

        // parent call post-processing, e.g. install event handlers

    } // eo function initComponent
    // }}}
    // {{{
    ,afterRender:function() {

        // parent call pre-processing

        // call parent
        AnExtension.superclass.afterRender.apply(this, arguments);

        // parent call post-processing, e.g. install event handlers on rendered components

    } // eo function afterRender
    // }}}

    // any other added/overriden methods
}); // eo extend

// register xtype
Ext.reg('anextension', AnExtension); 

// eof
Follow me:
Latest posts by saki (see all)

Want to collaborate on an upcoming project?