ExtJs布局中,控件如何水平居中?

如此即可,有图有代码有j8:

这里写图片描述

var formGridHead = Ext.create('Ext.form.Panel', {
        id: 'MyGridHead',
        region: 'north',
        bodyPadding: 10,
        bodyStyle: 'background:#fff',
        split: false,
        header: false,
        collapsible: true,
        items: [
                { xtype: 'panel'
                , border: false
                , layout: {
                    type: 'vbox',
                    align: 'center'
                }, width: '100%', items: [
                {
                    xtype: 'fieldcontainer'
                    , layout: 'column'
                    , items: [
{
    xtype: 'button',
    text: '标准查询',
    scale: 'medium',
    id: 'btnSearchOption',
    listeners: {
        click: {
    }
}
}, { html: '', border: false, width: 30 }
, {
    xtype: 'button',
    text: '高级查询',
    scale: 'medium',
    id: 'btnSearchOptionPower',
    listeners: {
        click: {
    }
}
}, { html: '', border: false, width: 30 }
                        , {
                            xtype: 'button',
                            text: '浏览统计图',
                            scale: 'medium',
                            id: 'btnViewTongji',
                            listeners: {
                                click: {
                            }
                        }
                    }
                        ]
                }
                    ]
                }
            ]
    });

其中重点在于:

, layout: {
                    type: 'vbox',
                    align: 'center'
                }, width: '100%',

你可能感兴趣的:(JavaScript)