What do I have to do to get a Border Layout to have the West container full height of the viewport?

StackOverflow https://stackoverflow.com/questions/17562609

  •  02-06-2022
  •  | 
  •  

Question

I am trying to use the Border layout in Extjs 4.2.1, when I specify North and South containers they expand and fill the entire horizontal space in the viewport, I want them to allow the West panel to be full height instead.

Here is some simple ASCII art version of what I am trying to achieve.

-----------------
|W|____North____|
|E|    Center   |
|S|_____________|
|T|    South    |
-----------------
Was it helpful?

Solution

You can also use the weight property to give precedence to a region—for example, giving precedence to the West region over the North region. All these changes mean that you should not often need nesting with border layout, speeding up rendering of components that use that layout.

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

    layout: {
        type: 'border'
    },

    initComponent: function() {
        var me = this;

        Ext.applyIf(me, {
            items: [
                {
                    xtype: 'panel',
                    region: 'west',
                    weight: -1,
                    width: 150,
                    title: 'My Panel'
                },
                {
                    xtype: 'panel',
                    region: 'north',
                    weight: -2,
                    height: 150,
                    title: 'My Panel'
                },
                {
                    xtype: 'panel',
                    region: 'south',
                    weight: -2,
                    height: 150,
                    title: 'My Panel'
                },
                {
                    xtype: 'panel',
                    region: 'east',
                    width: 150,
                    title: 'My Panel'
                },
                {
                    xtype: 'panel',
                    region: 'center',
                    title: 'My Panel'
                }
            ]
        });

        me.callParent(arguments);
    }

});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top