Basic Learning ExtJS notes (1)

Source: Internet
Author: User

After reading books for a few days, I checked the API. I can't remember much in my mind, so it's better to learn from it. Try to start writing:
First, start to build an interface framework.
The first step is to reference ExtJs related files:
<Link rel = "Stylesheet et" href = "resources/css/ext-all.css"/>
<Script type = "text/javascript" src = "ext-base.js"> </script>
<Script type = "text/javascript" src = "ext-all-debug.js"> </script>
Define an Ext. Viewport:
Set in items attributes:
Header:
Copy codeThe Code is as follows:
{
Region: 'north ',
Html: '

AutoHeight: false,
Border: false,
Margins: '0 0 5 0'
}

Management tree on the left:
Copy codeThe Code is as follows:
{
Region: 'west ',
Collapsible: true,
Title: 'Manage menus ',
Xtype: 'treepanel ',
Width: 200,
AutoScroll: true,
Split: true,
Loader: new Ext. tree. TreeLoader (),
Root: new Ext. tree. AsyncTreeNode ({
Expanded: true,
Children :[
{
Text: 'System settings ',
Leaf: true,
Url: 'userlist'
},
{
Text: 'user management ',
Leaf: false,
Children :[
{
Id: 'userlist', text: 'user list', leaf: true
}
]
},
{Id: 'News ',
Text: 'news information ',
Leaf: true
}]
}),
RootVisible: false,
Listeners :{
Click: function (node, event ){
// Ext. Msg. alert ('navigation Tree click', 'you clicked: "'+ node. attributes. text + '"');
Event. stopEvent ();
Var n = contentPanel. getComponent (node. id );
// Alert (n );
If (! N & node. leaf = true) {// determine whether the Panel has been opened
N = contentPanel. add ({
'Id': node. id,
'Title': node. text,
Closable: true,
AutoLoad :{
Url: node. id + '.html ',
Scripts: true
} // Use the autoLoad attribute to load the target page. To use a script, you must add the scripts attribute.
});
}
ContentPanel. setActiveTab (n );
}
}
}

Function panel on the right:
Copy codeThe Code is as follows:
New Ext. TabPanel ({
Region: 'center ',
EnableTabScroll: true,
ActiveTab: 0,
Items :[{
Id: 'homepage ',
Title: 'homepage ',
AutoScroll: true,
Html: '<div style = "position: absolute; color: # ff0000; top: 40%; left: 40%;"> homepage </div>'
}]
});

This is a simple interface. The interface is as follows:

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.