Javascript-extjs-Common methods and properties

Source: Internet
Author: User

Common methods and properties (Common methods and attributes)

Get

Get (x)

X is the ID of the element | | Dom Element Object | | Extelement Object

Converts the argument to a Extelement object and returns it (non-dom element object, but encapsulates the DOM element), which is equivalent to new Ext.element (x).

Ext.select (x)

X is the selector

Returns a Compositeelement object that represents the collection of Extelment objects. But the returned object is not actually an array, and the data it contains cannot be accessed through an array index. However, each object in the collection can be iterated through each method.

Ext.query (x)

X is the selector

Returns an array of HTML DOM element objects. This method is shorthand for Ext.DomQuery.select ().

Ext.DomQuery.filter (Compositeelement,selector,mach)

Compositeelement is a collection of Extelement objects, selector is a selector, and Mach is a Boolean value, meaning whether to reverse.

Filters out objects that conform to selector from the collection, and then Mach filters again. Returns the Compositeelement collection.

Ext.DomQuery.is (Domelement,selector)

DomElement is an HTML DOM element object | | A collection of HTML DOM element objects, selector is a filter.

Tests whether the DomElement matches the filter.

Extelmentarray.each (FN)

FN is a function

Iterates over the Compositeelement collection object, which contains the Extelement object. FN is used to process iterations, and the function receives a parameter e,e representing each Extelment object that is iterated.

Array.foreach (FN)

FN is a function

The elements of the iterated group, FN is used to process iterations, and the function receives a parameter e,e representing the elements of each array being iterated. If you want to iterate over the Extelment object, you should use the each method, if the array of iterations uses the Foreach method.

Ext.each (X,FN)

X is an array object | | Compositeelement Collection Objects

FN is the function used to process iterations, the function receives three parameters, item, index, Allitems,item is an element of an array of the current iteration, or the Extelement object in the Compositeelement collection, index is indexed, AllItems is x.

Ext.getdoc ()

Gets the Extelement object representation of an HTML document object.

Ext.getbody ()

Gets the Extelement object representation of the BODY element.

Ext.getdom (x)

X is the ID of the element | | HTML DOM Element Object | | Extelement Object

Gets the DOM object representation of the object.

EXT.GETCMP ()

Gets the ext component, which can be called by a function method prefixed by set to set the various properties of the component.

ext.isempty (x)

X is an Object | | Character

Tests whether the object is empty, and if it is a test character, you need to provide a second parameter specifying whether it can be empty.

Extelment.hide ()

Hides the Extelment object.

Extelm.highlight ();

Animate the extelment background by highlighting the yellow fade.

Extelement.on (EVENTTYPE,FN)

EventType is the event firing method, and FN is the event handler function.

<DivID= "Testbox"style= "width:100px;height:100px;background:black;color:white;margin:200px auto;text-align:center;">Click</Div>   <Scripttype= "Text/javascript">Ext.onready (function() {Ext.get ("Testbox"). On ("Click", function() {Ext.MessageBox.alert ("","Event click! "); });});</Script> 
View Code

Property

Extelment.dom

Gets the DOM representation of the Extelement object, which translates to a DOM element.

Manipulate

Ext.DomHelper.append (fatherelm,x)

Fatherelm is an HTML DOM object | | Extelement object, X is Htmlcode

Add X to the end of the Fatherelm.

Ext.DomHelper.applyStyles (X,styleobject)

X is an HTML DOM object | | Extelement Object

Sets the CSS for x.

Ext.DomHelper.applyStyles (Ext.get ("box"), {"Font-size": "50px"})
View Code

Ext.DomHelper.insertAfter (x, y)

X is the Extelement object, Y is the Htmlcode | | HTML DOM Object | | Extelement Object

Insert Y after x.

Ext.DomHelper.insertBefore (x, y)

X is the Extelement object, Y is the Htmlcode | | HTML DOM Object | | Extelement Object

Insert y before x.

Ext.DomHelper.insertHtml (Where,x,y)

X is an HTML DOM object, where is the indicator condition

Inserts y into the X, where indicated by where, as indicated by where. Where possible values are: Beforebegin (before inserting to the start tag of x) Afterbegin (after inserting to the start tag of x) Afterend (after inserting to the end tag of x) BeforeEnd (before the end tag of the x is inserted)

Ext.DomHelper.markup (x)

X is a Extelement object | | HTML DOM Object

Gets the HTML block for the object.

Ext.DomHelper.overwrite (x, y)

X is a Extelement object | | HTML DOM Object

Replace all of the HTML contained in x with Y.

Ext.DomHelper.createTemplate (x)

X is Htmlcode

Create an HTML template. The advantage of this approach is that it simplifies the need to repeatedly create HTML of the same structure to facilitate repeated calls to generate HTML or for other operations.

<Scripttype= "Text/javascript">varhtmltemplate=Ext.DomHelper.createTemplate ("<div id= ' {id} ' >{value}</div>");//create a template to define both a placeholder ID and valuehtmltemplate.append (Ext.get ("Box"), {ID:"ChildBox1", Value:"Hello" });//Add a div with id childBox1 text for hello in parameter 1htmltemplate.append (Ext.get ("Box"), {ID:"ChildBox2", Value:" World" });//Add a div with ID childBox2 text for world in Parameter 1</Script>
View Code

Javascript-Learning Total Directory

Javascript-extjs-Common methods and properties

Related Article

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.