ExtJS反转borderlayout行为

时间:2012-02-01 13:55:57

标签: javascript extjs border-layout

我有一个边框布局,所有区域都在使用中。

如您所知,borderlayout的正常行为是您定义北,南,东和西区域的初始大小,中心获取剩余的可用空间。

在我的情况下,我需要反过来。我希望中心,西部和北部区域具有确定的大小,并希望使所有其他区域获得剩余的可用空间。如果我调整浏览器窗口的大小,则外部区域不得流过中心内容。

实际上,当没有为外部区域定义尺寸时,中心会获得所有空间,如果我调整大小,只有中心区域缩小,其内容会被其他区域剧烈变形或重叠。

有谁知道怎么做?

1 个答案:

答案 0 :(得分:2)

嗯......我不知道这是不是你想要的。我使用vboxhbox布局来创建可能更接近您描述的内容:

new Ext.Window({
    xtype: 'window',        
    layout: 'vbox',
    title: 'My Window',
    layoutConfig: {
        align : 'stretch',
        pack  : 'start'
    },
    items: [
    {
        xtype: 'panel',
        height: 100,                
        title: 'My Panel'
    }, {
        xtype: 'container',
        height: 150,
        layout: 'hbox',
        layoutConfig: {
            align : 'stretch',
            pack  : 'start'
        },
        items: [
            {
                xtype: 'panel',                        
                width: 300,
                title: 'My Panel'
            }, {
                xtype: 'panel',                    
                title: 'My Panel',
                flex: 1
            }
        ]
    }, {
        xtype: 'panel',                
        title: 'My Panel',
        flex: 1
    }]
});