Question

I'm not sure how to go about this, buttonAlign: 'center' nor pack: 'center' are working. Fiddle: http://jsfiddle.net/3Ytp9/

Was it helpful?

Solution

Use the layout property of buttongroup:

    layout: {
        type: 'vbox',
        align: 'center'
    }

See forked fiddle: https://fiddle.sencha.com/#fiddle/1cm

OTHER TIPS

Have you considered using a toolbar in the bottom of your panel?

https://fiddle.sencha.com/#fiddle/1c0 (without mvc pattern)

You can also use something like this:

        dockedItems: [{
        xtype: 'toolbar',
        layout: {
            pack: 'center'
        },
        defaultButtonUI: 'default', // get default look and feel
        dock: 'bottom',
        items: [{
            xtype: 'button',
            width: 200,           
            text: 'Download to Excel',

        },{
            xtype: 'button',
            width: 200,           
            text: 'Another action',

        }]

Best Regards.

Try:

Ext.onReady(function() {
  var panel = Ext.create('Ext.form.Panel', {
    renderTo: Ext.getBody(),
    title: 'Button group',
    border: true,
    layout: {
        align: 'middle',
        pack: 'center',
        type: 'hbox'
    },
    width: 500,
    items: [{
        xtype: 'buttongroup',
        columns: 1,
        items: [{
            xtype: 'button',
            text: 'Go'
        }, {
            xtype: 'button',
            text: 'Reset'
        }]
    }]
 });
});

To have the buttons side by side, remove columns:1 - also note that the Ext JS implementation on JSFiddle is terrible, so dont rely on it too much.

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