Handling the layout dynamically

别等时光非礼了梦想. 提交于 2019-12-11 10:25:14

问题


Below is the code I tried:

<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>

When the west navigation panel is minimised, then the tabWidgetPanel is also moving towards left leaving the right side of the empty screen.

What I want is when the west navigation panel is collapsed, I want the tabWidgetPanel to increase in size and occupy the entire screen.


回答1:


Remove the renderTo from it, add region: 'center', remove height and remove width. The Region can't adjust when you define this. You are also writing reion: 'west'.



来源:https://stackoverflow.com/questions/12540640/handling-the-layout-dynamically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!