ExtJs4 (5) Basic Ext class, extjs4 learning ext class

Source: Internet
Author: User

ExtJs4 (5) Basic Ext class, extjs4 learning ext class

The Ext class is the most common and basic class in ExtJs. It is a global object and encapsulates all classes, Singleton instances, and practical methods provided by the Sencha library.


Most user interface components are nested in the namespace at a lower level, but many common utility functions are provided as direct attributes of the Ext namespace.


In addition, it provides many common methods, from other classes as shortcuts in the Ext namespace. For example, Ext. getCmp is the alias of Ext. ComponentManager. get.


Once DOM is ready, many applications start and call Ext. onReady. This ensures that all scripts have been loaded to prevent dependency issues. For example:

Ext.onReady(function(){    new Ext.Component({        renderTo: document.body,        html: 'DOM ready!'    });});

1 apply (Object object, Object config, [Object defaults]): Object

The parameter is the copied source object. The third parameter is optional, indicating that a default value is provided to the target object. You can simply copy the attributes of the third parameter (if any) and the second parameter to the first parameter object.

Var animal = {name: 'tome '} Ext. apply (animal, {age: 12, run: function () {console.info ('Happy running ')}});
The final animal object will also have the run method, animal. run ();


2 applyIf (Object object, Object config): Object

Similar to apply, the only difference is that if an object already has an attribute or method, config will not overwrite it.


3 decode (String json, Boolean safe): Object

The short form of Ext. JSON. decode decodes (parses) JSON string objects. If JSON is invalid, this function throws a SyntaxError unless security options are set.

var result = Ext.decode('{success:true,msg:xxxx}');console.info(result.success)//true
4 each (Array/NodeList/Object iterable, Function fn, [Object scope], [Boolean reverse]): Boolean

Ext.each([1,2,3,4,5,6],function(item,index,allItems){if(item<5){return false;}else{console.log(item);}});


5 fly (String/HTMLElement dom, [String named]): Ext. dom. AbstractElement. Fly

Get (String/HTMLElement/Ext. Element el): Ext. dom. Element

GetCmp (String id)

GetDom (String/HTMLElement/Ext. Element el)

Query (String path, [HTMLElement root], [String type]): HTMLElement []

Select (String selector): Ext. CompositeElement

The above has been learned in ExtJs4 (2): Dom operations


6 isArray (Object target): Boolean

IsBoolean (Object value): Boolean

IsDate (Object object): Boolean

IsElement (Object value): Boolean

IsEmpty (Object value, Boolean allowEmptyString): Boolean

IsFunction (Object value): Boolean

IsIterable (Object value): Boolean

IsNumber (Object value): Boolean

IsNumeric (Object value): Boolean

IsObject (Object value): Boolean

IsPrimitive (Object value): Boolean

IsString (Object value): Boolean

IsTextNode (Object value): Boolean

The above are basically object judgments. You can refer to the API


7 namespace (String...): Object

Ext.namespace('my.app.service');my.app.service.name = 'somnus';my.app.service.say = function(){console.info('hello')}
8 ns (String...): Object

Short Form of namespace


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.