1

下面是我试过的代码:

<script type="text/javascript">
    Ext.require(['*']);
    Ext.onReady(function() {
        Ext.Loader.setConfig({
            enabled: true
        });
        var totalScreenWidth = screen.availWidth;
        var totalScreenHeight = screen.availHeight;
        Ext.QuickTips.init();

        var viewport = Ext.create('Ext.ViewPort', {
            id: 'border-example',
            layout: 'border',
            items: [
            Ext.create('Ext.Component', {
                region: 'north',
                height: totalScreenHeight * 0.05,
                autoEl: {
                    tag: 'div',
                    html: '<p><center>UI Demo</center></p>'
                }
            }), {
                region: 'west',
                stateId: 'navigation-panel',
                id: 'west-panel',
                title: 'Tree View',
                split: true,
                width: totalScreenWidth * 0.2,
                collapsible: true,
                animCollapse: true,
                xtype: 'tabpanel',
                dockedItems: [{
                    dock: 'top',
                    xtype: 'toolbar'
                }],
                minSize: 175,
                maxSize: 400,
                margin: '0 5 0 0',
                activeTab: 1,
                tabPosition: 'bottom',
                items: [{
                    title: 'Tree View',
                    autoScroll: true
                }, {
                    title: 'Graphical View',
                    autoScroll: true
                }]

            },
            Ext.widget('tabpanel', {
                id: 'tabWidgetPanel',
                region: 'center',
                items: [{
                    contentEl: 'Tabs1',
                    title: 'Tab1',
                }, {
                    contentEl: 'Tabs2',
                    title: 'Tab2',
                }]
            })]
        });

        ext.get("hideit").on('click', function() {
            var w = Ext.getCmp('west-panel');
            w: collapsed ? w.expand() : w.collapse();
        });

    });
</script>

当西部导航面板最小化时,tabWidgetPanel 也会向左移动,离开空白屏幕的右侧。

我想要的是当西部导航面板折叠时,我希望tabWidgetPanel的大小增加并占据整个屏幕。

4

1 回答 1

1

从中删除renderTo,添加区域:'center',删除高度并删除宽度。当您定义此区域时,该区域无法调整。你也在写 reion: 'west'。

于 2012-09-22T06:32:16.730 回答