Extjs如何为vbox面板设置100%的高度

时间:2012-01-07 13:58:59

标签: layout extjs

enter image description here

〜您好,

我想将100%左右的高度设置为面板2.但我不知道该怎么做..

这是我的测试代码,

{
    title : 'EAST',
    region : 'east',
    layout : 'vbox',
    layoutConfig : {
        align : 'stretch'
    },
    bodyStyle : 'border:1px solid blue',
    width: 300,
    items : [
        new Ext.Panel({
            title : 'Panel 1',
            border : true,
            layout : 'fit',
            height : 250,
            html : 'PANEL 1 AREA'
        }),
        new Ext.Panel({
            title : 'Panel 2',
            border : true,
            bodyStyle : 'border:1px solid red',
            layout : 'fit',
            html : 'PANEL 2 AREA'
        })
    ]
}

我试过,autoHeight:true和height:'100%'到面板2,但它不起作用。

有谁知道,请帮帮我〜

谢谢〜!

2 个答案:

答案 0 :(得分:13)

您应该将flex属性用于第二个面板。

new Ext.Panel({
    title : 'Panel 2',
    border : true,
    bodyStyle : 'border:1px solid red',
    layout : 'fit',
    html : 'PANEL 2 AREA',
    flex: 1
})

答案 1 :(得分:4)

尝试在第二个面板中设置flex属性

    new Ext.Panel({
        title     : 'Panel 2',
        border    : true,
        bodyStyle : 'border:1px solid red',
        layout   : 'fit',
        html      : 'PANEL 2 AREA',
        flex      : 1

    })

flex仅在Component由已配置为使用BoxLayout的Container呈现时使用。 具有flex属性的每个子Component将垂直(通过VBoxLayout)或水平(通过HBoxLayout)根据项的相对flex值与指定flex值的所有Component的总和进行弯曲。