- Ext JS 3.0 Cookbook
- Jorge Ramon
- 302字
- 2021-04-01 13:43:48
Using a tabbed look
A tabbed GUI is modeled on the traditional card tabs or card indexes. It makes your screens easier to understand and navigate, and gives the application a more natural look. This recipe helps you to build a panel with three tabs, as shown in the following screenshot:

How to do it...
- Create the tabs. Each tab is simply a
Ext.Component
, such as a panel:var tab1={ title: 'First Tab', html: 'Content for the first tab' }; var tab2={ title: 'Second Tab', html: 'Content for the second tab' }; var tab3={ title: 'Third Tab', html: 'Content for the third tab' };
- What's left is to put the tabs in their containers:
var tabPanel=new Ext.TabPanel({ title: 'Tab Panels', width: 400, height: 300, applyTo: 'tab-panel', // Each tab is just a panel managed by the card layout. items: [tab1, tab2, tab3], activeItem: 0, defaults: {bodyStyle:'padding:5px'} });
After you build your tabs, use an Ext.TabPanel
as their container. The TabPanel
class displays one tab at a time using the CardLayout
layout manager.
When using TabPanel
, each child component fires events that only exist for tabs: activate
and deactivate
.
Tab panels can also be rendered from pre-existing markup, either already structured as a TabPanel
, or from different elements within the page by ID, regardless of page structure. For example, based on the following markup:
<div id="my-tabs" style="width:400px;margin:10px;"></div> <div id="tab1" class="x-hide-display" style="height:200px">A simple tab</div> <div id="tab2" class="x-hide-display" style="height:200px">Another one</div>
You need to add the following code to create a tab panel similar to the one in the next screenshot:
var tabPanel=new Ext.TabPanel({ renderTo: 'my-tabs', activeTab: 0, items: [ { contentEl: 'tab1', title: 'Tab 1' }, { contentEl: 'tab2', title: 'Tab 2' } ] });

- EJB 3.0 Database Persistence with Oracle Fusion Middleware 11g: LITE
- PS是這樣玩的:輕松掌握 Photoshop 通關秘籍
- Active Directory Disaster Recovery
- Photoshop CC 網(wǎng)店視覺設計
- AJAX and PHP: Building Modern Web Applications 2nd Edition
- Creo 4.0中文版從入門到精通
- CakePHP 1.3 Application Development Cookbook
- iPhone JavaScript Cookbook
- RESTful PHP Web Services
- 中文版Photoshop CS6平面設計實例教程(第2版)
- Photoshop+Adobe Camera Raw+Lightroom(攝影后期照片潤飾實戰(zhàn))
- Cassandra High Performance Cookbook
- Joomla! with Flash
- 從零開始:Photoshop CC 2019設計基礎+商業(yè)設計實戰(zhàn)
- After Effects CS6 標準教程