对齐:'伸展'不适用于Accordion布局

时间:2016-06-14 08:06:01

标签: extjs extjs4 extjs4.2 extjs5

我收录了一支'手风琴'布局,包含在' west'区域边界'布局。但是对齐:'伸展'属性不适用于手风琴布局。

手风琴布局

var user_menu_items = new Ext.Panel({
        layout: 'accordion',
        height: 565,
        align: 'stretch',
        id: 'usermenu',
        items: [{
                layout: 'fit',
                title: 'Configuration',
                id: 'menulist1',
                html: 'Group1 Content',
                collapseFirst: true
            }, {
                title: 'User Action Group2',
                id: 'menulist2',
                html: 'Group2 Content'
            }, {
                title: 'User Action Group3',
                id: 'menulist3',
                html: 'Group3 Content'
            }]
    });

边框布局

Ext.create('Ext.container.Viewport', {
        layout: 'fit',
        items: [{
                layout: 'border',
                defaults: {
                    collapsible: false,
                    split: false,
                    bodyStyle: 'padding:2px'
                },
                items: [{
                        title: 'USER MENU',
                        region: 'west',
                        margins: '5 0 0 0',
                        cmargins: '5 5 0 0',
                        width: 225,
                        minSize: 100,
                        maxSize: 250,
                        collapsible: true,
                        collapsed: false,
                        bodyStyle: 'padding:0px',
                        items: [user_menu_items]
                    }]
              }],
        renderTo: Ext.getBody()
    });

我正在使用extjs-4.2.2

enter image description here

2 个答案:

答案 0 :(得分:0)

你可以尝试下面的内容:

var user_menu_items = new Ext.Panel({
        layout: 'accordion',
        //height: 565,
        //align: 'stretch',
        id: 'usermenu',
        items: [{
                layout: 'fit',
                title: 'Configuration',
                id: 'menulist1',
                html: 'Group1 Content',
                collapseFirst: true
            }, {
                title: 'User Action Group2',
                id: 'menulist2',
                html: 'Group2 Content'
            }, {
                title: 'User Action Group3',
                id: 'menulist3',
                html: 'Group3 Content'
            }]
    });


Ext.create('Ext.container.Viewport', {
        layout: 'fit',
        items: [{
                layout: 'border',
                defaults: {
                    collapsible: false,
                    split: false,
                    bodyStyle: 'padding:2px'
                },
                items: [{
                        title: 'USER MENU',
                        region: 'west',
                        margins: '5 0 0 0',
                        cmargins: '5 5 0 0',
                        width: 225,
                        minSize: 100,
                        maxSize: 250,
                        collapsible: true,
                        collapsed: false,
                        bodyStyle: 'padding:0px',
                        layout: 'accordion', // <------- ADD THIS LINE TO WEST PANEL.------------------>
                        items: [user_menu_items]
                    }]
              }],
        renderTo: Ext.getBody()
    });

答案 1 :(得分:0)

如果我没弄错的话,Ext.panel.Panel没有配置选项align

配置选项align的内容是Ext.layout.container.Accordion

所以代码是:

var user_menu_items = new Ext.Panel({
    layout: {
        type:'accordion',
        align: 'stretch'
    },
    height: 565,
    ...