繁体   English   中英

Ext.js中的100%高度TabPanel(使用Sencha Architect)

[英]100% height TabPanel in Ext.js (using Sencha Architect)

我正在使用Sencha Architect,并且还没有弄清楚如何让我的TabPanel内容占据TabPanel所在容器的100%。

这是我现在使用的代码:

Ext.define('MyApp.view.MyViewport', {
    extend: 'Ext.container.Viewport',

    layout: {
        type: 'border'
    },

    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            items: [
                {
                    xtype: 'container',
                    region: 'north',
                    height: 60
                },
                {
                    xtype: 'container',
                    region: 'center',
                    items: [
                        {
                            xtype: 'tabpanel',
                            activeTab: 0,
                            items: [
                                {
                                    xtype: 'panel',
                                    layout: {
                                        type: 'fit'
                                    },
                                    title: 'Tab 1',
                                    items: [
                                        {
                                            xtype: 'panel',
                                            title: 'My Panel'
                                        }
                                    ]
                                },
                                {
                                    xtype: 'panel',
                                    title: 'Tab 2'
                                },
                                {
                                    xtype: 'panel',
                                    title: 'Tab 3'
                                }
                            ]
                        }
                    ]
                }
            ]
        });

        me.callParent(arguments);
    }

});

我完全不知道如何实现这一点,我无法在Ext.js文档中找到答案。

过度嵌套。 如果你有一个没有布局的容器,那么你经常会做错事:

Ext.define('Foo', {
    extend: 'Ext.container.Viewport',

    layout: 'border',

    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            items: [{
                xtype: 'container',
                region: 'north',
                height: 60
            }, {
                region: 'center',
                xtype: 'tabpanel',
                activeTab: 0,
                items: [{
                    title: 'Tab 1',
                    html: 'Tab 1'
                }, {
                    xtype: 'panel',
                    title: 'Tab 2',
                    html: 'Tab 2'
                }, {
                    xtype: 'panel',
                    title: 'Tab 3',
                    html: 'Tab 3'
                }]
            }]
        });

        me.callParent(arguments);
    }
});

Ext.onReady(function(){
    new Foo();
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM