"ExtJS" about alias and Xtype

Source: Internet
Author: User

Alias

In the API, the explanation is: Alias class name short alias list. Most used to define Xtypes

1Ext.define (' Myapp.panel ', {2Extend: ' Ext.panel.Panel ',3Alias: ' Widget.mypanel ',4Title: ' Mypanel '5 });6 7Ext.onready (function(){8     //using Ext.create9Ext.create (' Widget.mypanel ',{TenHTML: ' Create widget! ', Onewidth:400, Aheight:200, -Brodertrue, - renderTo:Ext.getBody ()}); the  -     //using Xtype -Ext.widget (' Panel ', { - renderTo:Ext.getBody (), +width:400, -Margin: ' 10 0 0 10 ', +Brodertrue, A items: [ at{xtype: ' Mypanel ', HTML: ' xtype1! '}, -{xtype: ' Mypanel ', HTML: ' xtyoe2! '} -         ] -     }); -  -  in});

Effect:

However, in the 5.0 official example, I often see examples where alias is rarely used to denote class aliases, but often used xtype to denote

1Ext.define (' Myapp.panel ', {2Extend: ' Ext.panel.Panel ',3     //alias: [' Widget.mypanel '],4Xtype: ' Mypanel ',5Title: ' Mypanel '6 });7 8Ext.onready (function(){9     //using Ext.createTenExt.create (' Widget.mypanel ',{ OneHTML: ' Create widget! ', Awidth:400, -height:200, -Brodertrue, the renderTo:Ext.getBody ()}); -  -     //using Xtype -Ext.widget (' Panel ', { + renderTo:Ext.getBody (), -width:400, +Margin: ' 10 0 0 10 ', ABrodertrue, at items: [ -{xtype: ' Mypanel ', HTML: ' xtype1! '}, -{xtype: ' Mypanel ', HTML: ' xtyoe2! '} -         ] -     }); -  in  -});

The effect is the same, it feels better to remember than the original, more intuitive.

  

"ExtJS" about alias and Xtype

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.