Extjs how to set 100% height for vbox panel

柔情痞子 提交于 2019-12-23 09:10:10

问题


Hi~,

I want to set 100% left over height to panel 2. but I don't know how to do..

here is my test code,

{
    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'
        })
    ]
}

I tried, autoHeight : true and height : '100%' to panel 2 but it does not work.

anybody knows, please help me ~

thank you~!


回答1:


You should use flex property for the second panel.

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



回答2:


try setting flex property in second panel

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

    })

flex is only used when Component is rendered by a Container which has been configured to use a BoxLayout. Each child Component with a flex property will be flexed either vertically (by a VBoxLayout) or horizontally (by an HBoxLayout) according to the item's relative flex value compared to the sum of all Components with flex value specified.



来源:https://stackoverflow.com/questions/8770207/extjs-how-to-set-100-height-for-vbox-panel

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!