2013-06-12 26 views
0

事我必須視:如何使上述Ext.Viewport

new Ext.Viewport({ 
    layout:'fit', 
    hideBorders:true, 
    items:[panel1,panel2,panel3], 
}); 

現在我想顯示上述視窗組合框:

var myCombo= new Ext.ComboBox({ 
    store:myStore, 
    editable:false, 
    renderTo:Ext.getBody(), 
    triggerActions:'all', 
    mode:'local', 
    cls:'scales' 
}); 

CSS:

.scales{ 
    position:absolute, 
    botton:1em, 
    right:1em, 
    background-color:white 
} 

但它的渲染在左邊。如何渲染它的右邊底部?

UPDATE

現在我把組合成Panle:

myPanel= new Ext.Panle({ 
items[myCombo], 
renderTo:Ext.getBody(), 
cls:'scales', 
border:false 
}); 

現在我的組合在右下角。但看起來像這樣: enter image description here

即使我從應用程序中刪除視口代碼,我得到的結果相同。我可以用組合做些什麼嗎?

+0

你不能。視口將採取整個身體。如果您想使組合框可見,請使用面板而不是視口 –

+0

@ javapirate:您可以舉個例子嗎? –

回答

1

你CSS壞了,應該是:

.scales{ 
    position: absolute; 
    bottom: 1em; 
    right: 1em; 
    background-color: white; 
} 

注意分號和bottom,而不是botton

編輯:

你應該使你的組合成一個窗口,讓內線管理的定位問題。下面是呈現一個簡約的窗口爲例:

var win = new Ext.Window({ 
    closable: false 
    ,resizable: false 
    // uncomment to make the window draggable 
    //,title: '...' 
    ,border: false 
    // uncomment to make the window modal 
    //,modal: true 
    ,items: [{ 
     xtype: 'combo' 
     ,store: ['Foo', 'Bar', 'Baz'] 
    }] 
}); 

win.show(); 

// then use anchorTo to position the window where you want: 
win.anchorTo(Ext.getBody(), 'br-br', [10, 10]); 

看到該文檔的anchorTo

+0

在我的代碼中沒問題。我只是在提出問題時犯錯。 –

+0

嗯。我嘗試使用窗口。 –

1

嘗試

new Ext.panel.Panel({ 
     layout:'fit', 
     items:[panel1,panel2,panel3], 
}); 

或者把你的連擊視裏面的物品爲:

new Ext.panel.Panel({ 
    layout:'fit', 
    items:[panel1,panel2,panel3, combo], 
}); 
+0

我更新的問題請看看它。 –

+0

嘗試玩你的佈局配置。現在你似乎在主面板中使用'layout:fit'。嘗試使用'layout:auto'或'layout:vbox' –