1. Get Method
The get method is used to obtain an ext element, that is, the type is Ext. object of element, ext. the element class is ext's Dom encapsulation, which represents the DOM elements. You can create an element object for each Dom, and you can use methods on the Element Object to perform operations specified on the Dom, for example, the hide method can hide elements and the initdd method can make the specified Dom have the drag-and-drop feature. The get method is short for Ext. element. Get.
The get method has only one parameter. this parameter is a hybrid parameter, which can be the ID of a DOM node, an element, or a DOM Node object. See the following sample code:
Ext. onready (function (){
VaR E = new Ext. element ("hello ");
Alert (Ext. Get ("hello "));
Alert (Ext. Get (document. getelementbyid ("hello ")));
Alert (Ext. Get (e ));
}); The HTML page contains a div with the ID of hello. The Code is as follows:
<Div id = "hello"> AAA </div>
Ext. onready (function (){
VaR E = new Ext. element ("hello ");
Alert (Ext. Get ("hello "));
Alert (Ext. Get (document. getelementbyid ("hello ")));
Alert (Ext. Get (e ));
}); The HTML page contains a div with the ID of hello. The Code is as follows:
<Div id = "hello"> AAA </div> Ext. get ("hello"), ext. get (document. getelementbyid ("hello"), ext. get (E) and other three methods can get an ext element corresponding to the DOM node hello.
2. getcmp method-obtain the ext component.
The getcmp method is used to obtain an ext component, that is, a component or its subclass object initialized on the page. The getcmp method is in short form of the Ext. componentmgr. Get method. The getcmp method has only one parameter, that is, the component ID. For example, the following code:
Ext. onready (function (){
VaR H = new Ext. Panel ({
ID: "h2 ",
Title :"",
Renderto: "hello ",
Width: 300,
Height: 200
});
Ext. getcmp ("h2"). settitle ("New title ");
});
Ext. onready (function (){
VaR H = new Ext. Panel ({
ID: "h2 ",
Title :"",
Renderto: "hello ",
Width: 300,
Height: 200
});
Ext. getcmp ("h2"). settitle ("New title ");
});
In the code, we use Ext. getcmp ("h2"). To obtain the component whose ID is H2, and call its settitle method to set the title of the Panel.
3. getdom method-Get DOM nodes
The getdom method can get the DOM nodes in the document. This method contains a parameter, which can be the ID of the DOM node, the DOM Node object, or the ext element (element) corresponding to the DOM node. For example, the following code:
Ext. onready (function (){
VaR E = new Ext. element ("hello ");
Ext. getdom ("hello ");
Ext. getdom (E );
Ext. getdom (E. DOM );
});
HTML:
<Div id = "hello"> tttt </div>
Ext. onready (function (){
VaR E = new Ext. element ("hello ");
Ext. getdom ("hello ");
Ext. getdom (E );
Ext. getdom (E. DOM );
});
HTML:
<Div id = "hello"> tttt </div>
In the above Code, ext. getdom ("hello"), ext. getdom (E), ext. getdom (E. DOM.
4. getbody method-get the body node element of the document ).
This method is used to directly obtain the document and document. the Zend element (element) corresponding to the DOM node of body is essentially the document. the body object is encapsulated into a Zend Element Object and returned. This method does not contain any parameters. For example, the following code directly renders panel H to the body element of the document.
Ext. onready (function (){
VaR H = new Ext. Panel ({Title: "test", width: 300, height: 200 });
H. Render (ext. getbody ());
});
Ext. onready (function (){
VaR H = new Ext. Panel ({Title: "test", width: 300, height: 200 });
H. Render (ext. getbody ());
});
5. The getdoc method-get the ext element (element) getdoc method corresponding to the document is essentially to encapsulate the current HTML document object, that is, the document object into a Zend Element Object and return it, this method does not contain any parameters