1. #1
    Sencha User
    Join Date
    Feb 2009
    Posts
    29
    Vote Rating
    0
    bocockli is on a distinguished road

      0  

    Default Extendable Class Pattern

    Extendable Class Pattern


    I have an increasing number of forms which seem to be sharing common code.

    Code:
    FormA = function() {
        
        // Here are common variables
        var msgBus = undefined;
        var formRecord= undefined;
    
        // This stuff is specific to each form
        var formPanel = new Ext.FormPanel({
            frame : true,
            labelAlign : 'right',   
            etc .....
        }
    
       // Here are some common functions
        function formUpdate() {
           ....
        }
        return { ......
    So my question is, is there a pattern for creating a base form of some type in ExtJS which can be extended.

    My thinking is either build a class extending Observable or create a generic Javascript object prototype.

    In Java (sorry I understand Java better than jscript) I would just create a base class and extend;

    class BaseClass{}
    class FormA extends BaseClass{}
    class FormB extends BaseClass{}

    What is the best approach that is flexible enough?

    Thanks, Len

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,833
    Vote Rating
    609
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    You can do the same:

    Code:
    BaseClass = Ext.extend(Object, {
        constructor : function(){
            //do stuff
        },
    
        method1 : function(){
        }
    });
    
    SubClass = Ext.extend(BaseClass, {
        constructor : function(){
            SubClass.superclass.constructor.call(this);
            this.method1();
        }
    });
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  3. #3
    Sencha User
    Join Date
    Feb 2009
    Posts
    29
    Vote Rating
    0
    bocockli is on a distinguished road

      0  

    Default


    Thank you, brilliant.

Thread Participants: 1

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi