EXT core API (IV)-Ext. domquery/domhelper/template

Source: Internet
Author: User
Ext. domquery class
For details about selector syntax, see ext class.

Compile (string selector, [string type]): Function
Compile a selector or XPath to query a method for reuse. The type value is one of the select (default) or simple values.

Filter (array El, string selector, Boolean nonmatches): Array
Filter the elements in El and retain those that match the selector. If nonmatches is true, the result is the opposite.

Is (string/htmlelement/array El, string selector): Boolean
Verify if El matches Selector

Select (string selector, [node root]): Array
Select an array of objects matching selector from Root

Selectnode (string selector, [node root]): Element
Returns the first selector-matched object in root.

Selectnumber (string selector, [node root], number defaultvalue): Number
Returns the node value of the first selector-matched object in the root, which is converted to an integer or floating-point number.

Selectvalue (string selector, [node root], string defaultvalue): void
Returns the node value of the first selector-matched object in root. If it is null, use the default value defaultvalue instead.

Ext. domhelper class
Append (mixed El, object/string o, [Boolean returnelement]): htmlelement/EXT. Element
Create a new Dom element and add it to El
Parameter o is a DOM object or an original HTML block.

Applystyles (string/htmlelement El, string/Object/function styles): void
Apply the style styles to the object El. For the Object Representation Method of the style, see Ext. element.

Createtemplate (Object O): Ext. Template
O creates a new Ext. template object. For details, see Ext. template.

Insertafter (mixed El, object o, [Boolean returnelement]): htmlelement/EXT. Element
Insertbefore (mixed El, object/string o, [Boolean returnelement]): htmlelement/EXT. Element
Create a new DOM object O and put them after El/

Insertfirst (mixed El, object/string o, [Boolean returnelement]):
Create a new Dom element and add it to El as the first child node (after reading this insertfirst, we recommend that you use the append alias insertlast :))

Inserthtml (string where, htmlelement El, string html): htmlelement
Where value: beforebegin/afterbegin/beforeend/afterend
Set htmlCodeInsert it near El,

Markup (Object O): String
Returns the HTML code corresponding to DOM object O.

Overwrite (mixed El, object/string o, [Boolean returnelement]):
Create a new Dom element O and use it to override El content

Ext. template class
The main function of the template class is to produce HTML fragments. For example
VaR T = new Ext. template (
'<Div name = "{ID}"> ',
'<SPAN class = "{CLS}"> {Name: trim} {value: ellipsis (10)} </span> ',
'</Div>'
);
T. append ('some-element', {ID: 'myid', CLS: 'myclass', name: 'foo', value: 'bar '});

Public method:
Template (string/array HTML)
Construct an Ext. template object. parameters can be HTML code in string format or an array consisting of them,

Template. From (string/htmlelement El, object config): Ext. Template
Construct a template using EL value (priority) or innerhtml

Append (mixed El, object values, [Boolean returnelement]): htmlelement/EXT. Element
Insertafter (mixed El, object values, [Boolean returnelement]): htmlelement/EXT. Element
Insertbefore (mixed El, object values, [Boolean returnelement]): htmlelement/EXT. Element
Insertfirst (mixed El, object values, [Boolean returnelement]): htmlelement/EXT. Element
This set of methods provides the HTML code generated by the value and is added to the Dom as the last sub-node of El, the next sibling node, the previous sibling node, and the first subnode.
For more information about values, see applytemplate.

Apply (): void
Applytemplate (Object values): String
Apply is short for applytemplate. If the parameter is a number values, it can be an array, or an array like {ID: 'myid', CLS: 'myclass', name: 'foo', value: JSON object like 'bar '}

Compile (): Ext. Template
Compile the template and replace \=>\\, \ r \ n | \ n ==>\\ N, '= \' in the template to facilitate processing by Js.

Overwrite (mixed El, object values, [Boolean returnelement]):
Use values to generate HTML to replace El content

Set (string HTML, [Boolean compile]): Ext. Template
Sets the HTML of the template. If compile is true, the compile method is called.

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.