PDA

View Full Version : Align label in the center of the toolbar ??



ing.amdangelo
14 Feb 2012, 1:16 AM
It's possible ?? in Ext js 3 is :

bbListaConv.on('afterlayout', function (tb) {
tb.el.child('.x-toolbar-right').remove();
var t = tb.el.child('.x-toolbar-left');
t.removeClass('x-toolbar-left');
t = tb.el.child('.x-toolbar-ct');
t.setStyle('width', 'auto');
t.wrap({ tag: 'center' });
}, null, { single: true });

but in extjs4 doesn't works

friend
14 Feb 2012, 4:29 AM
Override the Toolbar's default layout:



Ext.create('Ext.window.Window', {
dockedItems: [{
xtype: 'toolbar',
dock: 'top',
layout: {
type: 'hbox',
pack: 'center'
},
items: [{
xtype: 'tbtext',
text: 'Some Centered Text'
}]
}],
height: 250,
title: 'Toolbar Test',
width: 350
}).show();

amackay11
15 Mar 2013, 7:06 AM
You can add some whitespace to labels in the toolbar with this:


{ xtype: 'label', html: '<center>My App!
style: {
'width':'800px'
}
}