Use of extjs-Ext. Extend Functions

Source: Internet
Author: User

Ext. Extend plays a major role in extjs and is one of several important functions in extjs. To gain a deeper understanding of extjs, this function must be mastered. There are a lot of source code analysis and introduction to this function on the Internet. The usage of this function is as follows.

     Function Base (config ){ This . Name = Config. Name ; This . Age = config. Age; This . Sex = config. Sex ;} Function Base (config ){ This . Identity = config. identity; This . MSG = config. MSG;This . Phone = config. Phone; base. superclass. Constructor . Call ( This , Config);} Ext. Extend (base, base, {showmsg: Function (){ Window . Alert ( This . Name + ''+ This . Age + ''+ This . Sex + ''+ This . Identity + ''+ This . MSG + ''+ This . Phone );}});

    In this case

      1.  

    The second case is

       
      FunctionBase (config ){This.Name= Config.Name;This. Age = config. Age;This. Sex = config. Sex ;}
      VaRBase = ext. Extend (base, {showmsg:Function(){Window.Alert(This.Name+ ''+This. Age + ''+This. Sex + ''+This. Identity + ''+This. MSG + ''+This. Phone );}}
      WhenVaRMybase =NewBase (/**/); The base constructor function will be called.
       
       
      Case 3
        function  base (config) { This .  name  = config.  name ;  This . age = config. age;  This . sex = config. sex ;}
      VaRBase = ext. Extend ({Constructor:Function(Config ){This. Identity = config. identity;This. MSG = config. MSG;This. Phone = config. Phone;}, showmsg:Function(){Window.Alert(This.Name+ ''+This. Age + ''+This. Sex + ''+This. Identity + ''+This. MSG + ''+This. Phone );}}
      In this case VaR Mybase = New Base ( /**/ ); The constructor function passed in Ext. Extend will be called to analyze all three cases used by Ext. Extend. the inheritance system in extjs is constructed based on the above three cases. Article There are few text descriptions in. If you have read some text and do not know how to solve it, You can first analyze the Ext. Extend function source code, debug it several times, and then look back, it is estimated that you will understand the meaning of the article at once. The balsamiq software is used for drawing.

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.