2014-01-23 102 views
0

我正在嘗試向下一頁的標題爲'Foo參數'的左側面板添加一個滾動條。將滾動條添加到Ext.container.Veiwport的Java面板的左側面板

enter image description here

以下是我的代碼。

Ext.define('FOO.view.FooView', { 
    extend: 'Ext.container.Viewport', 
    alias: 'widget.pnlview', 

    layout: 'fit', 
    renderTo: Ext.getBody(), 

    constructor: function(config) { 
     this.items = [ 
      { 
       xtype: 'panel', 
       title: 'Foo Viewer', 
       frame: true, 
       layout: { 
        type: 'vbox', 
        align: 'stretch', 
        pack: 'start' 
       }, 
       items: [ 
        { 
         xtype: 'panel', 
         frame: true, 
         minHeight: 450, 
         flex: 7, 
         layout: { 
          type: 'hbox', 
          align: 'stretch', 
          pack: 'start' 
         }, 
         autoScroll: true, 
         items: [ 
          { 
           xtype: 'panel', 
           flex: 1, 
           layout: 'accordion', 
           layoutConfig: { 
            titleCollapse: false, 
            activeOnTop: true 
           }, 
           items: [ 
            { 
             xtype: 'pnlform', 
             title: 'Foo Parameters' 
            }, 
            { 
             title: 'Query Menu', 
             xtype: 'querygrid' 
            }, 
     /*       { 
             title: 'Drilldown Filters', 
             xtype: 'filtergrid' 
            }*/ 
           ] 
          }, 
          { 
           xtype: 'panel', 
           flex: 4, 
           layout: 'accordion', 
           layoutConfig: { 
            titleCollapse: false, 
            activeOnTop: true 
           }, 
           items: [ 
            { 
             title: 'Table Goodness', 
             id: 'pnlgrid', 
             xtype: 'pnlgrid' 
            }, 
            { 
             title: 'Graphmaster 3000', 
             xtype: 'panel', 
             frame: true, 
             y_axis: 'net_pnl', 
             layout: 'fit', 
             items: { 
              xtype: 'pnlchart' 
             } 
            } 
           ] 
          } 
         ] 
        }, 
        { 
         xtype: 'statsgrid', 
         region: 'south', 
         height: 54, 
         minWidth: 600 
        } 
       ] 
      } 
     ]; 

     this.callParent(arguments); 
    } 
}); 

我看了一個類似的帖子here;不過,我想知道如何手動設置左側面板的寬度。在左側面板上實現滾動條的最佳方式是什麼?

回答

0

FIX兒童面板的母面板的高度您嘗試添加滾動條,然後給自動滾屏:真到了那個父面板完蛋了......

Ext.onReady(function() { 
     Ext.create('Ext.panel.Panel', { 
      //title: 'Parent', 
      height: 200, 
      autoScroll: true, 
      width: 700, 
      id: 'Parent', 
      renderTo: Ext.getBody(), 
      items: [{ 
       xtype: 'panel', 
       title: 'Child', 
       height: 1000,     
       items: [{ 
        xtype: 'button', 
        text: 'Please Scroll me....', 
        listeners: { 
         click: { 
          fn: function() { 
           Ext.getCmp('Parent').scrollBy(500, 500, true); 
          } 
         } 
        } 
       }] 

      }] 
     }) 
    }); 
+0

你所指的父母和子女面板是什麼?我該如何設定高度? – idealistikz

+0

觀看此示例... – vino20

2

Sencha Fiddle screen shoot

Ext.application({ 
    name : 'Fiddle', 
    launch : function() { 

     Ext.create('Ext.Viewport', { 
      layout: 'fit', 
      renderTo: Ext.getBody(), 
      items: [{ 
        xtype: 'panel', 
        title: 'Foo Viewer', 
        frame: true, 
        layout: { 
         type: 'vbox', 
         align: 'stretch', 
         pack: 'start' 
        }, 
        items: [{ 
          xtype: 'panel', 
          frame: true, 
          minHeight: 450, 
          flex: 7, 
          layout: { 
           type: 'hbox', 
           align: 'stretch', 
           pack: 'start' 
          }, 
          autoScroll: true, 
          items: [{ 
            xtype: 'panel', 
            flex: 1, 
            layout: 'accordion', 
            layoutConfig: { 
             titleCollapse: false, 
             activeOnTop: true 
            }, 
            items: [{ 
              xtype: 'panel', 
              title: 'Foo Parameters', 
              autoScroll: true, 
             items:[{ 
              xtype: 'panel', 
              title: 'Controls panel', 
              height:1000, 
              margin:5 
             }] 
             }, { 
              title: 'Query Menu', 
              xtype: 'panel' 
             }] 
           }, { 
            xtype: 'panel', 
            flex: 4, 
            layout: 'accordion', 
            layoutConfig: { 
             titleCollapse: false, 
             activeOnTop: true 
            }, 
            items: [{ 
              title: 'Table Goodness', 
              id: 'pnlgrid', 
              xtype: 'panel' 
             }, { 
              title: 'Graphmaster 3000', 
              xtype: 'panel', 
              frame: true, 
              y_axis: 'net_pnl', 
              layout: 'fit', 
              items: { 
               xtype: 'panel' 
              } 
             }] 
           }] 
         }, { 
          xtype: 'panel', 
          region: 'south', 
          height: 54, 
          minWidth: 600 
         }] 
       }] 
     }); 

    } 
}); 
+0

我實施了您的更改,但是當我加載站點時,它顯示爲空白。 – idealistikz

+0

只需使用chrome,按F12,選擇Sources選項卡,然後按F5,查看錯誤。這裏是工作示例http://jsfiddle.net/LFF8T/用我的代碼替換你,我會發現錯誤並修復它 –