[Original] basics: Article 3 common ext Methods

Source: Internet
Author: User
Tags button type

Before writing each ext component usage, summarize some of the commonly used ext methods in your work. only list some frequently used and occasionally used descriptions. the ext framework encapsulates some situations that we often encounter at work into methods. If you are interested in reading its source code, you will find that the encapsulated statements are no different from what we usually write. it is really a pleasure to read its source code. Although I still don't understand it in many places, I think its source code is indeed the best tutorial for learning JavaScript. ext-all-debug.js and ext-core-debug.js these two files are debugging files, very clear, if I have 2 months of vacation time, I am willing to spend all the time on the above.

I want to talk about the method I want to talk about. I think I 'd like to talk about the onready () method of the ext class again, it specifies the function to be executed after all the frameworks of the ext class are loaded. the specific function to be executed is its parameter.

1: Ext. getcmp ("Object ID"): This method has only one parameter, that is, the component ID.

Note: After executing the following statement, click OK to bring up some attribute values of the defined ext button, and change the original value from "OK" to "cancel"
 

<Body>
<Form ID = "form1" runat = "server">
<Div>
<SCRIPT type = "text/JavaScript">
Function ready ()
{
// This function has two main functions:
// A button for obtaining the defined buttonname. Message pop-up results
// Change the value of the buttonname button from "OK" to "canceled"
VaR settext = function ()
{
// Get the object of the specified parameter through the getcmp method. The parameter value is the ID of an ext object that has been initialized on the page.
// The getcmp () method has only one parameter, that is, the component ID.
VaR BTN = ext. getcmp ("buttomid ");
// Obtain the button ID
VaR id = BTN. ID;
// Obtain the button text
VaR text = BTN. text;
// Obtain the button type
VaR type = BTN. type;
VaR result = "execution result: Id =" + ID + "text =" + TEXT + "type =" + type;
Ext. msg. Alert ("message", result );
// Settext is to reset the text of the button to "cancel" the new text"
Ext. getcmp ("buttomid"). settext ("cancel ");
};
// Define a button and execute the settext function after the event is triggered.
VaR buttonname = new Ext. Button
({
ID: "buttomid ",
Text: "OK ",
Renderto: Document. Body,
Handler: settext
});
}
Ext. onready (ready );
</SCRIPT>
</Div>
</Form>
</Body>

// Second: Ext. getbody (); // This method is equivalent to document. Body.
// The preceding two methods are frequently used,

There are many others that I don't like to use, such as: ext. get ("a parameter"); Ext. getdom ("one parameter"); Ext. getdoc ("without Parameters ");

I will not introduce them one by one.

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.