Set a unique ID for each extjs component. Otherwise, an error occurs. _ extjs-js tutorial.

Source: Internet
Author: User
Each component of extjs must have a unique ID. Otherwise, various errors may occur. EXTJS basically relies on ID to identify each extjs component of the component. You must set a unique ID. Otherwise, various errors may occur.

EXTJS basically relies on ID to identify components. If you have a textfield with ID: "keyword" in panel1 and there is a textfield with the same ID in panel2, when you disable panel2, because extjs finds that the ID: "keyword" component in panel2 is still in use in panel1, it will not be destroyed, so it becomes an isolated object, this causes confusion.

In any case, you must always remember that the Object ID must be unique at any time. There are two practices:

1. Do not specify an ID for the object, and then use the find method of the component to find the object through other attributes, such as find ("name", "role"). An array is generated. Of course, your attributes are unique, so you can Reference Components in the form of find ("name", "role") [0.

2. You can also specify the child component in the form of parent component ID + child component ID. this method is better. In extjs, the child component ID is changed to this. id + "_ role". Note that this refers to the parent component. In an instance, because the ID of the parent component must be unique, even if two instances of the same component have the same ID, the child components of the two instances have a unique ID. In this way, the ID duplication problem can be well handled.

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.