This article to record the study notes
• We have had a preliminary understanding of ExtJS in previous studies, so if you want to learn ExtJS well, it is necessary for JavaScript, that is to say, understanding ExtJS underlying infrastructure. So now we're going to start learning ExtJS's infrastructure. – How to create an ext class, create a complex process for a class • Define a class's method: Define for the ext4.x version, the Define method of the newly defined class is used instead of the previous version of the Extend method, and a new class is defined. Let's take a look at the use of the define. Ext.define (Classname,properties,callback); –classname: The class name of the new class to be defined –properties: The configuration object of the new class –callback: callback function, executes the function when the class is created · For ext to define a new class, then we can imagine that Since the use of Ext.define to create a class, the class created must be the class of ext, different from the traditional JavaScript to create a class, that is, we want to configure the second parameter of the Define method properties configuration, we need to find ext for the class supported API and to match Well, it's customary to go to the chestnuts, see the Chestnut code.
1Ext.onready (function () {2 //Config, constructor constructor3 4 //How to define a class in Ext: Ext.define (ClassName, properties, callback)5Ext.define (' person ',{6 //Here are some of the configuration information for this class7 //the Config property is the property content of the current class, and the Get and set methods are added8 config:{9Name: ' Z3 ' , TenAge:20 One }, A //a method of your own definition -Sayfunction(){ -Alert (' I am the method ... '); the }, - //adds a constructor to the currently defined class to initialize the information -Constructorfunction(config) { - varme = This ; +Me.initconfig (config);//true initialization passed in parameters - } + }); A at //ext.create instantiation of an object - varp = ext.create (' person '),{ -Name: ' Harry ' , -Age:30 - }); -Alert (P.getname ());//Harry inAlert (P.getage ());// - -P.say ();//I am the method ... to +})
A class is defined, today will be here, there are questions welcome to my message, tomorrow to everyone to say the Ext class inheritance
Recommend a article Net www.fishcmonkey.com, learn to improve literary accomplishment
Ext JS Learning Sixth day Ext custom Class (i)