- 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' } ] });

- 中文版AutoCAD 2015實用教程
- Word論文排版之道
- Blender 3D Architecture, Buildings, and Scenery
- 邊做邊學:Photoshop+CorelDRAW綜合實訓教程
- Blender 2.5 Materials and Textures Cookbook
- CMS Design Using PHP and jQuery
- Building Websites with ExpressionEngine 1.6
- Moldflow 2021模流分析從入門到精通(升級版)
- CAXA 實體設計2013案例課堂
- 3D打印輕松實踐:從材料應用到三維建模
- 新編 中文版Photoshop平面設計入門與提高
- Mastercam 2019 完全自學寶典
- Deep Inside osCommerce: The Cookbook
- 中文版3ds Max 2014/VRay 效果圖制作實例教程(全彩超值版)
- 剪映:短、中、長視頻剪輯全攻略(手機版+電腦版)