</head>
<body onload="prettyPrint();">
<pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.2.0
+ * Ext JS Library 3.2.1
* Copyright(c) 2006-2010 Ext JS, Inc.
* licensing@extjs.com
* http://www.extjs.com/license
* @type Menu
* The {@link Ext.menu.Menu Menu} object associated with this Button when configured with the {@link #menu} config option.
*/
+ /**
+ * @cfg {Boolean} autoWidth
+ * By default, if a width is not specified the button will attempt to stretch horizontally to fit its content.
+ * If the button is being managed by a width sizing layout (hbox, fit, anchor), set this to false to prevent
+ * the button from doing this automatic sizing.
+ * Defaults to <tt>undefined</tt>.
+ */
initComponent : function(){
Ext.Button.superclass.initComponent.call(this);
if(!Ext.isEmpty(this.oldCls)){
this.el.removeClass([this.oldCls, 'x-btn-pressed']);
}
- this.oldCls = (this.iconCls || this.icon) ? (this.text ? ' x-btn-text-icon' : ' x-btn-icon') : ' x-btn-noicon';
+ this.oldCls = (this.iconCls || this.icon) ? (this.text ? 'x-btn-text-icon' : 'x-btn-icon') : 'x-btn-noicon';
this.el.addClass([this.oldCls, this.pressed ? 'x-btn-pressed' : null]);
}
},
// private
doAutoWidth : function(){
- if(this.el && this.text && this.width === undefined){
+ if(this.autoWidth !== false && this.el && this.text && this.width === undefined){
this.el.setWidth('auto');
if(Ext.isIE7 && Ext.isStrict){
var ib = this.btnEl;