Ext. PanleExt. TabPanelExt. Viewport page 1/3 _ ExtJs

Source: Internet
Author: User
Use of the basic panel of ExtJs learning notes (Ext. Panle, Ext. TabPanel, and Ext. Viewport)
1. Create a simple Panel Ext. Panel
2. Create a Panel Ext. Panel that can be dragged
3. Use the tab panel
3. Use Ext. Viewport to build a simple layout (use a small example to summarize all the content in this article)
Panel is the foundation of ExtJs controls. Many controls are extended based on the panel, or they may be related to other controls.
A panel consists of a toolbar, a bottom toolbar, a panel header, a rear panel, and a main area. This class also provides functions such as panel expansion and closure. Some reusable tool buttons are provided for flexible control panel. The Panel can be placed in any other container, and the Panel itself is also a container, so the Panel can also contain other components. The Panel class is Ext. panel, and its xtype is Panel.
The following example shows the components of the Panel:
// Common panel
Function panel (){
Var panel = new Ext. Panel ({
RenderTo: 'panel ',
Title: 'panel head ',
Width: 400,
Height: 200,
Html :'

The main display area of the Panel. It can contain any html code.

',
Tbar: [{text: 'top toolbar buttons '}],
Bbar: [{text: 'bottom toolbar '}],
Buttons :[
{
Text: 'button at the bottom of the Panel ',
Handler: function ()
{
Ext. Msg. alert ('hs', 'event of the button at the bottom of the panel! ');
}
}
]
});
}
The above code is not described in detail. Note that renderTo: 'panel '. This Code binds the panel to a p layer, and the panel is the ID of p.



After the code is executed, the following results are displayed:

Good results! The Panel can have multiple Toolbar, which can be located at the top or bottom of the Panel. The Ext Toolbar is represented by the Ext. Toolbar class. The toolbar can store buttons, text, and other content. Some practical tool bar are also provided in the Panel. You can add tool bar options to the panel header through the tools Configuration Attribute. See the following example:
Function panel (){
Var panel = new Ext. Panel ({
Tools :[
{Id: "save "},
{Id: "help "},
{Id: "up "},
{
Id: "close ",
Handler: function (){
Ext. MessageBox. alert ("toolbar button", "toolbar close button event ")
}
}
],
RenderTo: 'panel ',
Title: 'panel head ',
Width: 400,
Height: 200,
Html :'

The main display area of the Panel. It can contain any html code.

',
Tbar: [{text: 'top toolbar buttons '}],
Bbar: [{text: 'bottom toolbar '}],
Buttons :[
{
Text: 'button at the bottom of the Panel ',
Handler: function ()
{
Ext. Msg. alert ('hs', 'event of the button at the bottom of the panel! ');
}
}
]
});
}

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.