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

Pregunta

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    |
-----------------
¿Fue útil?

Solución

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);
    }

});
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top