ExtJS4 Border布局簡單案例


閑話少說,先上效果圖

Extjs中border布局將界面分為東西南北以及中五個部分,可以根據需要來是否聲明,但記住,中心區域一定要聲明,而且中心區寬度是根據東西南北部分來自動調整的,

不需要設置寬度,如果你要設置寬度,你可以在東西南北部分來設置

實現代碼:

 1 <script type="text/javascript">
 2  Ext.onReady(function(){
 3    Ext.application({
 4         name:'測試Extborder布局!',
 5         launch:function(){
 6                 Ext.create('Ext.panel.Panel',{
 7                     width:800,
 8                     height:600,
 9                     layout:'border',
10                     items:[
11                             {
12                                 title:'北部',
13                                 region:'north',//指定顯示區域
14                                 html:'這是北部內容區',
15                                 height:100,
16                                 xtype:'panel',
17                             },
18                             {
19                                 title:'中心區',
20                                 region:'center',//布局一定要布局中心區,不然報錯
21                                 html:'這是中心內容區',
22                                 height:400,//不要在中心區定義寬度,寬度是隨其他區域而自適應
23                             },
24                             {
25                                 title:'西部區',
26                                 region:'west',
27                                 html:'<h3 style="color:red;">這是西部內容區</h3>',
28                                 height:400,
29                                 width:200,
30                                 split:true,//為true時寬度可以通過拖動調整。
31                             },
32                             {
33                                 title:'東部區',
34                                 region:'east',//布局一定要布局中心區,不然報錯
35                                 html:'<h3 style="color:green;">這是東部內容區</h3>',
36                                 height:400,
37                                 width:50,
38                             },
39                             {
40                                 title:'南部區',
41                                 region:'south',
42                                 html:'<h3 style="color:blue;">這是南部內容區</h3>',
43                                 height:100,
44                             },
45                           ],//忘記寫此逗號將不會顯示,建議寫一個屬性時后面及時添加逗號
46                         renderTo:Ext.getBody()
47                 });
48         }
49    });
50  });
51 </script>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM