Ext.require(['*']); Ext.onReady(function() { Ext.Loader.set...">

Dynamic layout control

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 western navigation bar is minimized, the tabWidgetPanel also moves to the left, leaving the right side of the blank screen.

What I want is when the western navigation bar crashes, I want the tabWidgetPanel to increase in size and cover the entire screen.

+1
source share
1 answer

Remove renderTo from it, add an area: 'center', remove the height and remove the width. A region cannot configure when you define it. You also write reion: "west".

+1
source

Source: https://habr.com/ru/post/1750801/


All Articles