admin管理员组文章数量:1308191
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?
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?
2 Answers
Reset to default 2You 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);
}
});
Insert buttonAlign: 'center',
and it should center - the default is right
, I think. See this example.
本文标签: javascriptCenteralign a button in ExtJSStack Overflow
版权声明:本文标题:javascript - Center-align a button in ExtJS - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741857173a2401412.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论