2011-04-05 230 views
1

我需要爲我們的報告系統創建一個先進的,流暢的邊界佈局。ExtJS先進的流體邊界佈局

西面窗格將被拆分成2個獨立的窗格,頂部用於過濾窗體,底部用於導航。

中心窗格將被拆分爲3個獨立的窗格,頂部爲主數據網格,2個底部窗格爲子報表網格。我可能在某個時候需要3個底部窗格,但我希望避免這種情況。

這裏是我所期待的一個例子:http://dl.dropbox.com/u/298258/Amistaff/desiredLayout.png

我到目前爲止肯定是不盡如人意。

http://dl.dropbox.com/u/298258/Amistaff/currentLayout.png

下面是代碼:

var ReportForm = new Ext.FormPanel({ 
    url:   '', 
    frame:   false, 
    border:   false, 
    title:   'Filter Results', 
    width:   260, 
    labelWidth:  50, 
    padding:  '10 0 0 5', 
    standardSubmit: true, 
    items:   [ 
         { 
          fieldLabel:  'Client',      
          hiddenName:  'ClientID', 
          mode:   'local', 
          store:   frmClientStore, 
          displayField: 'CompanyName', 
          valueField:  'ClientID', 
          width:   150, 
          editable:  true, 
          triggerAction: 'all', 
          xtype:   'combo' 
         } 

    ], 
    buttons:  [ 
         {text:'Export',handler:function(){}}, 
         {text:'Search',handler:function(){}}, 
         {text:'Reset',handler:function(){}} 
    ] 
}); 

var ReportGrid = new Ext.grid.GridPanel({ 
    id:     'ReportGrid', 
    width:    '100%', 
    height:    '50%', 
    viewConfig:   { 
          forceFit:  true 
    }, 
    autoHeight:   true, 
    loadMask:   true, 
    stripeRows:   true, 
    store:    ReportStore, 
    margins:   '5 5 5 5', 
    cm:     ReportColumnModel 
    ,bbar:    new Ext.PagingToolbar 
         (
          { 
           pageSize:  10, 
           store:   ReportStore, 
           displayInfo: true, 
           displayMsg:  'Displaying results {0} - {1} of {2}' 
          } 
         ) 

}); 

var viewport = new Ext.Viewport({ 
    layout:   'border', 
    items:   [ 
         { 
          region:    'west', 
          layout:    'vbox', 
          layoutConfig:  { 
                align:  'stretch' 
          }, 
          width:    260, 
          minSize:   175, 
          maxSize:   400, 
          margins:   '5 5 5 5', 
          items:    [ 
                ReportForm, 
                { 
                 region:  'south', 
                 title:  'Superuser', 
                 border:  false, 
                 xtype:  'tabpanel', 
                 activeTab: 0, 
                 items:  [ 
                     { 
                      title:  'General', 
                      xtype:  'panel', 
                      height:  200, 
                      html:  '', 
                     }, 
                     { 
                      title:  'Exams', 
                      height:  200, 
                      html:  '' 
                     } 
                    ] 
                } 
               ] 
         }, 
         new Ext.Panel({ 
          region:    'center', 
          deferredRender:  false, 
          layout:    'fit', 
          margins:   '5 5 5 0', 
          items:    [ 
                ReportGrid, 
                new Ext.Panel({ 
                 region:  'south', 
                 border:  false, 
                 height:  '50%', 
                 html:  'foo', 
                 layout:  'fit', 
                 items:  [ 
                     new Ext.Panel({ 
                      region:  'west', 
                      width:  '50%', 
                      border:  false, 
                      html:  'West' 
                     }), 
                     new Ext.Panel({ 
                      region:  'east', 
                      width:  '50%', 
                      border:  false, 
                      html:  'East' 
                     }) 
                    ] 
                }) 
               ] 
         }) 
        ] 
}); 

謝謝...

編輯:

非常感謝AMOL下面的答案。我還有一個問題。如果我在西部地區摺疊表格,我該如何調整導航面板以填充剩餘空間?

回答

4

enter image description here

碼 -


var ReportForm = new Ext.FormPanel({ 
     url:   '', 
     frame:   false, 
     border:   false, 
     title:   'Filter Results', 
     width:   260, 
     labelWidth:  50, 
     padding:  '10 0 0 5', 
     standardSubmit: true, 
     items:   [ 
          { 
           fieldLabel:  'Client',      
           hiddenName:  'ClientID', 
           mode:   'local', 
           //store:   frmClientStore, 
           displayField: 'CompanyName', 
           valueField:  'ClientID', 
           width:   150, 
           editable:  true, 
           triggerAction: 'all', 
           xtype:   'combo' 
          } 

     ], 
     buttons:  [ 
          {text:'Export',handler:function(){}}, 
          {text:'Search',handler:function(){}}, 
          {text:'Reset',handler:function(){}} 
     ] 
    }); 

    var ReportGrid = new Ext.grid.GridPanel({ 
     id:     'ReportGrid', 
     flex:1, 
     viewConfig:   { 
           forceFit:  true 
     }, 
     loadMask:   true, 
     stripeRows:   true, 
     //store:    ReportStore, 
     margins:   '5 5 5 5', 
     cm:     new Ext.grid.ColumnModel({ 
      columns:[ 
        {header:'A column', dataIndex:'afield'}, 
        {header:'B column', dataIndex:'bfield'} 
      ] 
     }), 
     store:new Ext.data.ArrayStore({ 
      autoLoad:true, 
      fields:['afield', 'bfield'], 
      data:[['value 1','value 3'],['value 2', 'value4']] 
     }), 
     bbar:    new Ext.PagingToolbar 
          (
           { 
            pageSize:  10, 
            //store:   ReportStore, 
            displayInfo: true, 
            displayMsg:  'Displaying results {0} - {1} of {2}' 
           } 
          ) 

    }); 

    var viewport = new Ext.Viewport({ 
     layout:   'border', 
     items:   [ 
          { 
           region:    'west', 
           layout:    'vbox', 
           layoutConfig:  { 
                 align:  'stretch' 
           }, 
           width:    260, 
           minSize:   175, 
           maxSize:   400, 
           margins:   '5 5 5 5', 
           items:    [ 
                 ReportForm, 
                 { 
                  region:  'south', 
                  title:  'Superuser', 
                  border:  false, 
                  xtype:  'tabpanel', 
                  activeTab: 0, 
                  items:  [ 
                      { 
                       title:  'General', 
                       xtype:  'panel', 
                       height:  200, 
                       html:  '' 
                      }, 
                      { 
                       title:  'Exams', 
                       height:  200, 
                       html:  '' 
                      } 
                     ] 
                 } 
                ] 
          }, 
          new Ext.Panel({ 
           region:    'center', 
           deferredRender:  false, 
           layout:    'vbox', 
           layoutConfig:{align:'stretch'}, 
           margins:   '5 5 5 0', 
           items:    [ 
                 ReportGrid, 
                 { 
                  border:  false, 
                  flex:1, 
                  layout:  'hbox', 
                  layoutConfig:{align:'stretch'}, 
                  defaults:{flex:1}, 
                  items:  [ 
                      new Ext.Panel({ 
                       html:  'West' 
                      }), 
                      new Ext.Panel({ 
                       html:  'East' 
                      }) 
                     ] 
                 } 
                ] 
          }) 
         ] 
    }); 
+0

太棒了!謝謝。 – cmhampton 2011-04-05 19:55:25