ExtJS Learning--------Ext.define definition Classes

Source: Internet
Author: User
Tags define definition

Ext class Class Configuration item: ( Note: ExtJS's Chinese help document: http://download.csdn.net/detail/z1137730824/7748893

ExtJS configuration file and example: http://download.csdn.net/detail/z1137730824/7754771 )



Grammar:

Define ( String className, Object data, Function CREATEDFN )

Instance:

Ext.onready (function () {///syntax: define (String className, Object data, function CREATEDFN) ext.define (' person ', {// For the configuration information for the Class//config property: Configures the property contents of the current class, and automatically adds the Get and set methods Config:{name: ' Zhang San ', age:30},//the method of its own definition mymethod:function () {alert (' This is your own definition of the method ');},//adds the constructor constructor:function (config) {var me=this;//to the currently defined class//can view the contents of the configuration item//for (var attr in config )//{//alert (attr+ ":" +config[attr]);//}me.initconfig (config);//True initialization of the passed in Parameters});// Ext recommended methods for instantiating objects: Ext.createvar p=ext.create (' person ', {//class name of the class you defined name: ' instantiated name ',//config item age:100}); alert (' Name: ' + P.getname () + '--age: ' +p.getage ());//Call the Get method added by default P.mymethod ();//Invoke its own defined method});
Operation result;




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.