- Ext JS 3.0 Cookbook
- Jorge Ramon
- 508字
- 2021-04-01 13:43:49
Creating a modern application layout with collapsible regions
This layout is very popular in modern applications where the GUI consists of multiple nested panels with split bars and collapsible regions. Here's a sample that you can use as a foundation for your applications as seen below:

How to do it...
- Set up the panels of the application:
northPanel={ title: 'North Panel', region: 'north', height: 150, minSize: 75, maxSize: 250, cmargins: '0 0 5 0' } southPanel={ title: 'South Panel', region: 'south', height: 150, minSize: 75, maxSize: 250, cmargins: '5 0 0 0' } westPanel={ title: 'West Panel', region: 'west', margins: '0 0 0 0', cmargins: '0 5 0 0', width: 175, minSize: 100, maxSize: 250 } eastPanel={ title: 'East Panel', region: 'east', margins: '0 0 0 0', cmargins: '0 0 0 5', width: 175, minSize: 100, maxSize: 250 } centerPanel={ title: 'Center Panel', collapsible: false, region: 'center', margins: '0 0 0 0' }
- Now, build the container and add the panels to it:
When creating this complex layout, you first need to decide on the configuration for each of your panels: what region each panel will belong to, which panels will be collapsible, and what will be the panel margins when expanded and when collapsed.
When it comes to putting the panels in their container, the layout that you must use is Ext.layout.BorderLayout
.
The regions of a BorderLayout
are fixed at render time. Thereafter, no regions may be removed or added. Be mindful that a BorderLayout
must have a center region, which will always fill the space that is not used up by the other regions in the layout.
Border layouts are very popular in modern applications due to the efficient use of space that can be achieved in the GUI. They also contribute to having well-defined interface areas that encapsulate elements that work together to perform a piece of functionality.
Examine how you can use nested border layouts to divide the West Panel into two separate regions, as shown in the following screenshot:

Firstly, set up the two panels that will make up the two regions within the West Panel:
nestedPanel1={ region: 'north', height: 150 } nestedPanel2={ region: 'center' }
Observe how nestedPanel2
is assigned to the center region, so it fills the space not used by nestedPanel1
.
As the final step, modify the West Panel by adding the nested panels, and configure its layout as a BorderLayout:
westPanel={ title: 'West Panel', region: 'west', margins: '0 0 0 0', cmargins: '0 5 0 0', width: 175, minSize: 100, maxSize: 250, bodyStyle:'border:0px', layout: 'border', defaults: { collapsible: true, split: true, bodyStyle: 'padding:15px' }, items:[nestedPanel1,nestedPanel2] }
- EJB 3.0 Database Persistence with Oracle Fusion Middleware 11g: LITE
- ModelSim電子系統分析及仿真(第3版)
- MATLAB計算機視覺經典應用
- After Effects CC影視后期制作實戰從入門到精通
- Animate 2022動畫制作:團體操隊形
- Excel 2010 商務數據分析與處理(第2版)
- 中文版AutoCAD 2014高手之道
- 零基礎學數碼攝影后期
- 中文版3ds Max 2021完全自學教程
- Java EE 6 with GlassFish 3 Application Server
- 正則表達式必知必會(修訂版)
- Python 3 Object Oriented Programming
- Word-Excel-PowerPoint 2010三合一辦公應用實戰從入門到精通(超值版)
- 金融精英PPT實操手冊:世界知名公司這樣展示研究報告
- AutoCAD 2024室內設計從入門到精通(升級版)