Common functions of extjs4

Source: Internet
Author: User
Tags html decode
EXT provides a core ext class, which is a single-instance class and cannot be directly created. This class provides support for calling various components and controls of Ext. 1. ext. onready ()

This method is called after the document object is loaded, before the onload event of HTML and image are loaded.

The first parameter is the function called by the method after loading. If the third parameter is true, the second parameter will become the execution range of FN. If the third parameter is not passed, the default value is true.

This function is very important. All resources must be loaded before you can call etjs functions. the DOM of ext is dynamically generated, And the onready call method ensures the request security when all document objects are loaded, all processing should be performed in onready.

Call format:

Ext. onready (function FN, object scope, Boolean override)

Parameter description:

FN: The executed function.

Scope: the range of FN execution, which is an optional parameter.

Override: Indicates whether to use scope as the default FN execution range. This parameter is optional and the default value is true.

Returned value: none.

2. Ext. Get ()

Obtain the element in HTML and the element in Dom.

Call format:

Ext. Get (mixed El)

Parameter description:

El: a specified Dom Element Node ID, Dom element, or an existing HTML element.

Returned value: Element Object.

3. Ext. Select ()

Ext. Select () obtains the objects applied to the style sheet based on CSS (style sheet), which is also known as the style sheet selector.

Call format:

Ext. Select (string/array selector, [Boolean unique], [htmlelement/string root])

Parameter description:

Selector: string value, indicating that the element or element array is obtained by selecting the CSS type.

Unique: optional parameter. Whether to obtain a unique element. If the optional value is false, an array set that meets the conditions is obtained.

Root: optional parameter. It is the root node of the selector when querying. If this value is null, the query starts from document.

Return Value:

Compositeelementlite/compositeelement

If Unique is true, compositeelement is returned; otherwise, compositeelementlite is returned.

4. Ext. Query ()

Select a node array in the DOM tree using the given path. the real implementation is by Ext. domquery. select, but it only provides an ext. domquery. simple and quick call of secect. at the same time, it also provides four selector call methods, that is, path can be any of the four selection methods, such as selecting by element and by attribute, select by pseudo type and by CSS style sheet.

Call format:

Ext. Query (string path, [node root])

Parameter description:

Path: The Node path when the selector queries.

Root: optional parameter. It is the Start Node of the selector query. If this value is null, the query starts from document.

Return Value:

Array: returns an array of qualified nodes.

5. Ext. getcmp ()

Return the Component Object of the specified ID managed by Ext. component. It is actually a packaging call of Ext. componentmgr. Get (ID.

Call format:

Ext. getcmp (string ID)

Parameter description:

ID: ID of the specified component.

Return Value:

Ext. Component: returns the Ext. component object or its subclass object.

6. Ext. getdom ()

You can use the specified ID, Dom node, or element to obtain the HTML element ).

Call format:

Ext. getdom (mixed El)

Parameter description:

El: node element, node ID, or HTML element.

Return Value:

Htmlelement: HTML node.

7. Ext. isempty ()

Determines whether the specified element or node is empty. if the specified node value is null and undefined, true is returned. if the specified node is an empty string object and the string is allowed to be null (that is, the second parameter is true), false is returned; otherwise, true is returned.

Call format:

Ext. isempty (mixed value, [Boolean allowblank])

Parameter description:

Value: the object to be judged. It can be an object or a string.

Allowblank: an optional parameter. when determining whether an object is a null string, it indicates whether to allow null results. If null is allowed, the Null String is used to determine whether the returned result is false, if null is not allowed, true is returned when null strings are used for judgment ..

Return Value:

Boolean: determines whether the result is null.

8. Ext. namespace ()

After creating a specified namespace, you can define variables, methods, and classes under the namespace. in this case, these variables or classes will be in this namespace. When you reference this class, you must use this namespace to reference it. at this time, these variables belong to the specified namespace, avoiding conflicts caused by these variables reference.

Call format:

Ext. namespace (string namespace1, string namespace2, string etc)

Parameter description:

Namespace1 and namespace2 indicate namespaces respectively.

9. Ext. Each ()

Iterate on an array or set, and call the specified function for the objects in the set. and the for loop respectively call a function to process the specified set with the same function. the execution of each () controls whether to continue the next iteration through the specified function. If the specified function returns false upon execution, the iteration is terminated. if the specified boundary is not a real set, only one iteration is executed, that is, the iteration ends after the first iteration.

Call format:

Ext. Each (array/nodelist/Mixed Array, function FN, object scope)

Parameter description:

Array: Specifies the set to be iterated.

FN: Specifies the function for processing each object in the set. when FN is executed, the returned results are used to determine whether to perform fn processing for the next element for items in the set. when FN is called, the parameter Jiang Yi FN (item, index, allitems) is passed in the form, where item is the element in the set for each iteration, index is the subscript of each iteration, and allitems is the set of iteration, that is, the range.

Scope: Specifies the range.

Return Value: None

10. Ext. Apply ()

Copies an attribute for the specified object, or initializes an object with the default attribute. when you call it again, it means to copy all the attributes of the second parameter config to the attributes of the first parameter OBJ object. If config is empty, copy the defaults attribute of the third parameter to the OBJ attribute.

Call format:

Ext. Apply (Object OBJ, object config, object defaults)

Parameter description:

OBJ: Target copy object

Config: Source copy object property set.

Ults: Default attribute value.

Return Value:

Object: returns OBJ, that is, the Copied object.

11. Ext. encode ()

Parses the defined JSON object into a string, which is a standard Ext. JSON. encode. During the call, the parameter object is parsed and a string is returned.

Call format:

Ext. encode (Object OBJ)

Parameter description:

OBJ: the object to be parsed.

Return Value: string.

12.ext.html decode ()

Converts a defined HTML string to an htnl standard character.

Call format:

Ext.html decode (string value)

Parameter description:

Value: the string to be converted.

Return Value: string, the converted string.

13. Ext. typeof ()

Determines the type of the passed parameter. If the parameter is an undefined object, undefined is returned. If the parameter is a space, null is returned. If the parameter is a string, string is returned, if the parameter is a DOM element, return element. If the parameter is a blank space character, return whitespace.

Call format:

Ext. typeof (mixed value)

Parameter description:

Value: an object, table, number, date object, table object, etc.

Return Value: String, value type.

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.