Extjs Study Notes (knowledge point summary)

Source: Internet
Author: User

(1) apply () and applyif ()

Apply (): Copy all attribute values of an object to another object. var A = {Name: 'xiaosi', age: '23'}; var B = {Name: 'sjf', age: '24'}; Ext. apply (B, A); alert ("name:" + B. name + "Age:" + B. age); Result: Name: xiaosi age: 23 applyif (): Copies all attribute values of an object to another object. However, if a property already exists in the target object, ext. applyif () won't overwrite it. VaR A = {Name: 'xiaosi', age: '23', sex: 'male'}; var B = {Name: 'sjf', age: '24 '}; ext. applyif (B, A); alert ("name:" + B. name + "Age:" + B. age + "Sex:" + B. sex); Result: Name: xiaosi age: 23 Sex: Male

(2) Difference between get (), getdom (), and getcmp ()

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. (Same as getelementbyid) • Ext. onready (function (){

VaR E = new Ext. element ("hello ");

Ext. getdom ("hello ");

Ext. getdom (E );

Ext. getdom (E. DOM );

}); • // The HTML page contains a div with the ID of hello. The Code is as follows:

<Div id = "hello"> AAA </div> •

In the above Code, ext. getdom ("hello"), ext. getdom (E), ext. getdom (E. DOM.

• 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. • The get method is short for Ext. element. Get. • Ext. onready (function (){

VaR E = new Ext. element ("hello ");

Ext. Get ("hello "));

Ext. Get (document. getelementbyid ("hello "));

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.

• The getcmp method is used to obtain an ext component, that is, a component that has been initialized on the page or its subclass object. The getcmp method has only one parameter, that is, the component ID. • The getcmp method is short for the Ext. componentmgr. Get method. • Ext. onready (function (){
VaR mypanel = new Ext. Panel ({
ID: "myfirstpanel ",
Title: "Old title ",
Renderto: "hello ",
Width: 300,
Height: 200
});

Ext. getcmp ("myfirstpanel"). settitle ("New title ");

}); • // The HTML page contains a div with the ID of hello. The Code is as follows:

<Div id = "hello"> AAA </div> • Ext. getcmp ("myfirstpanel "). to obtain the component whose ID is myfirstpanel, and call its settitle method to set the title of the Panel.

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.