- 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] }
- 中文版3ds Max 2016/VRay效果圖制作實(shí)戰(zhàn)基礎(chǔ)教程
- Flash CS6標(biāo)準(zhǔn)教程(全視頻微課版)
- 中文版Premiere影視編輯課堂實(shí)錄
- Unity 2D與3D手機(jī)游戲開發(fā)實(shí)戰(zhàn)
- jQuery Mobile First Look
- CakePHP 1.3 Application Development Cookbook
- Word 2010實(shí)戰(zhàn)技巧精粹
- 中文版CorelDRAW X8基礎(chǔ)培訓(xùn)教程(全彩版)
- iPhone Applications Tune/Up
- 中文版Photoshop CS6從新手到高手(超值版)
- Elasticsearch數(shù)據(jù)搜索與分析實(shí)戰(zhàn)
- UG NX 12.0中文版從入門到精通
- Altium Designer 21 PCB設(shè)計(jì)官方指南(高級(jí)實(shí)戰(zhàn))
- iOS智能手機(jī)APP界面設(shè)計(jì)實(shí)戰(zhàn)教程
- Photoshop后期強(qiáng):多重曝光專業(yè)技法寶典