Common tools and functions of extjs4 Ext. Core. domhelper

Source: Internet
Author: User

As an Ajax framework, ext interacts with HTML and Dom and has many operations. The domhelper class plays a very Coupled Role, allowing Hu Yong to operate HTML or DOM transparently through Ext. In this way, you can easily operate ext's element and htmlelement.

1. Ext. Core. domhelper. append ()

Use El to obtain this node and append O to the sub-node of El. If returnelement is true, the added ext element is returned. Otherwise, the added htmlelement is returned.

Call format:

Ext. Core. domhelper. append (mixed El, object/string o, [Boolean returnelement])

Parameter description:

El: the specified HTML element or domelement.

O: The objects appended to the El node play the specified string value.

Returnelement: identifies whether the node generated after append is htmlelement or domelement. If it is true, the system returns Ext. Core. element, that is, Dom element.

Return Value:

Returns Ext. element or HTML element.

2. Ext. Core. domhelper. applystyle ()

Apply the specified CSS (style sheet) effect to the specified HTML element (element node.

Call format:

Ext. Core. domhelper. applystyle (string/HTML element El, string/Object/function styles)

Parameter description:

El: ID or HTML element pair of the HTML Element Object.

Styles: CSS style sheet of the application

Returned value: none.

3. createtemplate ()

Create an Ext. template (standard template of ext) using the specified object or string, and return the template.

Call format:

Ext. Core. domhelper. createtemplate (Object O)

Parameters:

O: Create a DOM object using this object.

Returned value: the created Ext. template object is returned.

4. insertafter ()

Obtain the specified element, append the new node to the obtained element, and return the specified node.

Call format:

Ext. Core. domhelper. insertafter (mixed El, object o, [Boolean returnelement])

Parameter description:

El: Specifies the context element.

O: object or DOM node to be appended

[Returnelement]: optional parameter, indicating whether to return the new Ext. element after the node is inserted. Otherwise, the returned HTML element is generated after the node is inserted.

Returned value: htmlelement or ext. Element

5. insertbefore ()

Obtain the specified element, append the new node to the obtained element, and finally return the specified node.

Call format:

Ext. Core. domhelper. insertbefore (mixed El, object o, [Boolean returnelement])

Parameter description:

El: Specifies the context element.

O: object or DOM node to be appended

[Returnelement]: optional parameter, indicating whether to return the new Ext. element after the node is inserted. Otherwise, the returned HTML element is generated after the node is inserted.

Returned value: htmlelement or ext. Element

6. insertfirst ()

Create an object created by O appended to the specified element, become the first child element of the element, and finally insert and append the node.

Call format:

Ext. Core. domhelper. insertfirst (mixed El, object/string o, [Boolean returnelement])

Parameter description:

El: Specifies the context element.

O: newly inserted objects or nodes described by strings.

[Returnelement]: optional parameter, indicating whether to return the new Ext. element after the node is inserted. Otherwise, the returned HTML element is generated after the node is inserted.

Returned value: htmlelement or ext. Element

7. inserthtml ()

Insert HTML at the specified position in the given htmlelement and return the added htmlelement.

Call format:

Ext. Core. domhelper. inserthtml (string where, HTML element El, string HTML)

Parameter description:

Where: the location where HTML is inserted. The value can only be beforebegin/afterbegin/beforeend/afterend.

El: Specifies the HTML element and the target HTML element.

HTML: the HTML string to be inserted.

Returned value: htmlelement

8. Overwrite ()

Obtain the specified element, overwrite the internal body of the element according to the new content body, and return the overwritten node.

Call format:

Ext. Core. domhelper. Overwrite (mixed El, object/string o, [Boolean returnelement])

Parameter description:

El: Specifies the element node.

O: newly inserted objects or nodes described by strings.

[Returnelement]: optional parameter, indicating whether to return the new Ext. element after the node is inserted. Otherwise, the returned HTML element is generated after the node is inserted.

Returned value: htmlelement or ext. Element

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.