After learning about the basics, you may use ext + ajax to develop a simple small project. The project development process will be explained in 1.1 drops, hoping to bring you some benefits! Because I am also learning this frameworkArticleIf you have any suggestions, I may learn more.
If you see this picture, you may think it is a software, or flash, flex, Silverlight, etc., but this is implemented by JavaScript + CSS.
If you look at the style and effect in your project, the user's visual and operational experience should be very refreshing. There are more special effects.
Let's start with this component. extjs is a good Ajax framework written in JavaScript. We can see the effect above. We can apply extjs to any web development language. The client is very powerful. At the same time, ext also provides a mechanism for interacting with the server, which is very convenient to use. The article on ext interacting with the server will be written later.
Before the application we need to get this framework, you can go to the http://extjs.com/products/extjs/download.php official website to download, open source. After downloading and decompressing the package, you will get the following directory.
Adapter: maps the third-party underlying libraries (including the underlying libraries provided by ext) to the underlying libraries supported by Ext.
Build: All ext source code after compression (classified storage)
Docs: API help documentation
Examples: some examples of extjs results
Resources: ext UI resource file directory where CSS and images are stored
Source: No compressed ext source code
Ext-all.js: Compressed ext all source code, key files ah, more than 500 k
Ext-all-debug.js: no compression ext all source code (for debugging)
Ext-core.js: core components, including all classes under source/Core
Ext-core-debug.js: Core Components Without Compression
Next, we will perform a test on a pure static html page. To apply extjs, we need to first import three script files and one style sheet.
< LINK rel = " Stylesheet " Type = " Text/CSS " Href = " Extjs/resources/CSS/ext-all.css " />
< Script SRC = " Extjs/ext-base.js " Type = " Text/JavaScript " > </ Script >
< Script SRC = " Extjs/ext-all.js " Type = " Text/JavaScript " > </ Script >
< Script SRC = " Extjs/ext-lang-zh_CN.js " Type = " Text/JavaScript " > </ Script >
here, after the extjs file is loaded, ext. the function specified in onready can be tested using a simple Code .
the two methods can achieve the same effect.
Note: Ext. onready (start) does not require () .
Ext. messageBox. alert ( " OK " , " the extjs framework has been loaded! " ); is used to output a dialog box.
Ext. messageBox. alert ('title', 'Pop-up content'); it can also be written as Ext. MSG. alert ('','');
the running effect is as follows
An alert dialog box can be easily implemented using extjs. Prompt ('',''); there are also relative application methods in extjs.
Function prompt (){
Ext. MessageBox. Prompt (
"Input ",
"Input a number :",
Function (button, text ){
If (Button = "OK ")
Ext. MessageBox. Alert ("Number", "the number is" + text );
Else
Ext. MessageBox. Alert ("sorry", "the number is null .");
}
);
}
This syntax is slightly troublesome. Ext. MessageBox. Prompt ('title', 'note: ', the function to be executed after completion). The executed function requires two parameters: button and text. The button is used to determine whether the user has selected the cancel or OK option. If it is OK, the value is 'OK '. Text is the input text.
Only two small examples are provided for illustration, and confim and other usage are similar.
There is also a common and easy-to-understand window box.
You can drag this beautiful box and click X to close it.
The usage is as follows:
Function window (){
VaR win = new Ext. Window ({Title: "hello", width: 300, height: 200, HTML: 'This is the body .'});
Win. Show ();
}
Create an Ext. Window object and call the show method to display the object.
Ext. window can be used to input many parameters in the constructor. Only the content displayed in the title, width, height, and body areas is used here.
New Ext. window ( {title: " " , width: 300 , height: 200 , HTML: ' This is the body. ' } );
title: "" set the title
width: 300 width
Height: 200 height
HTML: 'xxxx' can hold any HTML code