0

私は Sencha Architect を使用していますが、TabPanel が存在するコンテナの 100% を TabPanel コンテンツで占有する方法をまだ理解していません。

これは私が今使っているコードです:

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 ドキュメントで答えを見つけることができませんでした。

4

1 に答える 1

2

過剰なネスティング。レイアウトのないコンテナがある場合、多くの場合、何か間違ったことをしています:

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();
});
于 2012-10-15T21:30:00.080 に答える