Extjs4: The difference between event and method, as well as Config Options and Public Pro

Source: Internet
Author: User

I. Differences between event and method

Method, you can directly call the object method in the program, obj. method ();
Event is the processing function when an event occurs. It is set by listening to the event.
Use configuration items
Listeners :{
Xxx: function (){....}
}
Or
Obj. on ("xxx", function (){....});
The function is called only when an event occurs.

Ii. What are the differences between attributes and configuration items in Ext?
General attributes are relative to "An Instance" and "an object.
Config item is used in Ext for configuration items that are passed into the component during initialization.
The configuration item is not changed after it is passed in, and it is not necessarily accessible. However, attributes can be read or written.

The upper split line is used as an example -------------------------------------------------------------------------------------------------------------
The content in Config Options is configured when you instantiate an object, that is, new Panel ({a: "xxx", B: "yyy "}), here, a and B are from Config Options.
Take the TreeNode under the tree as an example:

Checked under Config Options
Checked: Boolean
True to render a checked checkbox for this node, false to render an unchecked checkbox (defaults to undefined with no...
True to render a checked checkbox for this node, false to render an unchecked checkbox (defaults to undefined with no checkbox rendered)

TreeNode is the meaning of a tree node, so it must be a node.
While checked clearly means we can guess whether it is selected or not.
This checked is used in Confgi Options for instantiation. You do not know if it can be used in other cases.
The value of this configuration option must only accept values of the boolean type, that is, true or false.
For example, var root = new Ext. tree. TreeNode ({checked: true });
For example, href: String indicates that the configuration option href accepts the string type.
This so-called configuration option, that is, the content in Config Options, is only used when you instantiate it, that is, your new class name ({...}) and then you can look at the Public Properties section to see this childNodes. childNodes: Array under public properties indicates the attributes you get from an instantiated object, for example, var tn = new Ext. tree. treeNode ({....}); this has already instantiated an object, so now you can get the data of the instantiated object. How can we get it? What can we get in it, so what is listed in the public properties here is what you can get, so you need tn. childNodes can get an Array type of data, so the information listed in public properties is the information that can be obtained by an instantiated object, and the return type of the information you requested is after the colon.

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.