Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
143
rated 0 times [  150] [ 7]  / answers: 1 / hits: 15402  / 11 Years ago, mon, may 27, 2013, 12:00:00
var myWin = new Ext.Window({
height : 100,
width : 200,
maximizable : true,
items : [ {
xtype : 'button',
text : 'myButton'
// align : center
} ]

});
myWin.show();


This is my code. I want to align the button to center, i know there are ways to do that but they are a bit long and tricky, is there a simple solution like align : center or something like that, that should align button or text fields to center?


More From » extjs

 Answers
17

enter



You can try this. It's one way(I add picture of my window)



 Ext.define('MyApp.view.MyWindow', {
extend: 'Ext.window.Window',

height: 137,
width: 233,
layout: {
align: 'middle',
pack: 'center',
type: 'hbox'
},
title: 'My Window',

initComponent: function() {
var me = this;

Ext.applyIf(me, {
items: [
{
xtype: 'button',
text: 'MyButton'
}
]
});
me.callParent(arguments);
}
});

[#78005] Friday, May 24, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
malaysias

Total Points: 619
Total Questions: 110
Total Answers: 107

Location: Czech Republic
Member since Thu, Aug 11, 2022
2 Years ago
;