2016-11-09 41 views
0

我創造這樣一個窗口網格:ExtJS的4個GridPanel中在窗口惱人的水平滾動條

Ext.create('Ext.data.Store', { 
    storeId:'simpsonsStore', 
    fields:['name', 'email',], 
    data:{'items':[ 
     { 'name': 'Lisa', "email":"[email protected]" }, 
     { 'name': 'Bart', "email":"[email protected]" }, 
     { 'name': 'Homer', "email":"[email protected]" }, 
     { 'name': 'Marge', "email":"[email protected]" } 
    ]}, 
    proxy: { 
     type: 'memory', 
     reader: { 
      type: 'json', 
      root: 'items' 
     } 
    } 
}); 

Ext.create("Ext.window.Window", { 
title: 'BlaBla', 
closable: true, 
modal: true, 
width: 800, 
height: 460, 
layout: 'fit', 
items: [ 
    { 
     xtype: 'gridpanel', 
     autoScroll: true, 
     store: Ext.data.StoreManager.lookup('simpsonsStore'), 
     title: 'Choose which features you would like to use to create parts.', 
     // height: 300, 
     columns: { 
      items: [ 
       { 
        header: 'Name', 
        tooltip: 'Name', 
        dataIndex: 'name', 
        flex: 1 
       }, 
       { 
        header: 'Email', 
        tooltip: 'Email', 
        dataIndex: 'email', 
        flex: 1 
       } 
      ] 
     } 
    }, 

] 
}).show(); 

這是產生這樣的窗口: window with grid

然而,GridPanel中有一個惱人水平滾動條,因爲列是合適的,所以不需要。

爲什麼該滾動條被創建,應該使用什麼?

+0

我沒有看到任何滾動條,當我在小提琴中運行你的代碼。 @UDID:即使沒有改變任何寬度,它看起來不錯。 – Srikanth

+0

@Srikanth可能是,但是當我創建小提琴時,它顯示滾動條,所以我認爲這是因爲窗寬。如果窗口小於實際網格,那麼這通常發生。 – UDID

回答

1

此滾動條是由於窗口的寬度和高度而創建的,並非因爲網格。你請調整窗口的寬度,你會得到期望的結果。我改變窗口的width,完美地來。這裏是你的fiddle

0

不要指定高度&寬度窗口,把它給你的網格面板。 因爲這個窗口獲得自動高度爲&的寬度,僅僅取決於網格。 ;)