4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-container-ButtonGroup-method-constructor'><span id='Ext-container-ButtonGroup'>/**
19 </span></span> * @class Ext.container.ButtonGroup
20 * @extends Ext.panel.Panel
21 * <p>Provides a container for arranging a group of related Buttons in a tabular manner.</p>
23 * {@img Ext.container.ButtonGroup/Ext.container.ButtonGroup.png Ext.container.ButtonGroup component}
24 * <pre><code>
25 Ext.create('Ext.panel.Panel', {
26 title: 'Panel with ButtonGroup',
29 renderTo: document.body,
30 html: 'HTML Panel Content',
50 menu: [{text: 'Menu Item 1'}]
52 xtype:'splitbutton', text: 'Cut', iconCls: 'add16', menu: [{text: 'Cut Menu Item'}]
54 text: 'Copy', iconCls: 'add16'
56 text: 'Format', iconCls: 'add16'
60 * </code></pre>
62 * Create a new ButtonGroup.
63 * @param {Object} config The config object
66 Ext.define('Ext.container.ButtonGroup', {
67 extend: 'Ext.panel.Panel',
68 alias: 'widget.buttongroup',
69 alternateClassName: 'Ext.ButtonGroup',
71 <span id='Ext-container-ButtonGroup-cfg-columns'> /**
72 </span> * @cfg {Number} columns The <tt>columns</tt> configuration property passed to the
73 * {@link #layout configured layout manager}. See {@link Ext.layout.container.Table#columns}.
76 <span id='Ext-container-ButtonGroup-cfg-baseCls'> /**
77 </span> * @cfg {String} baseCls Defaults to <tt>'x-btn-group'</tt>. See {@link Ext.panel.Panel#baseCls}.
79 baseCls: Ext.baseCSSPrefix + 'btn-group',
81 <span id='Ext-container-ButtonGroup-cfg-layout'> /**
82 </span> * @cfg {Object} layout Defaults to <tt>'table'</tt>. See {@link Ext.container.Container#layout}.
88 defaultType: 'button',
90 <span id='Ext-container-ButtonGroup-cfg-frame'> /**
91 </span> * @cfg {Boolean} frame Defaults to <tt>true</tt>. See {@link Ext.panel.Panel#frame}.
97 internalDefaults: {removeMode: 'container', hideParent: true},
99 initComponent : function(){
100 // Copy the component's columns config to the layout if specified
104 me.noTitleCls = me.baseCls + '-notitle';
106 me.layout = Ext.apply({}, {columns: cols}, me.layout);
110 me.addCls(me.noTitleCls);
112 me.callParent(arguments);
115 afterLayout: function() {
118 me.callParent(arguments);
120 // Pugly hack for a pugly browser:
121 // If not an explicitly set width, then size the width to match the inner table
122 if (me.layout.table && (Ext.isIEQuirks || Ext.isIE6) && !me.width) {
123 var t = me.getTargetEl();
124 t.setWidth(me.layout.table.offsetWidth + t.getPadding('lr'));
128 afterRender: function() {
131 //we need to add an addition item in here so the ButtonGroup title is centered
133 me.header.insert(0, {
141 me.callParent(arguments);
145 onBeforeAdd: function(component) {
146 if (component.is('button')) {
147 component.ui = component.ui + '-toolbar';
149 this.callParent(arguments);
153 applyDefaults: function(c) {
154 if (!Ext.isString(c)) {
155 c = this.callParent(arguments);
156 var d = this.internalDefaults;
158 Ext.applyIf(c.initialConfig, d);
167 <span id='Ext-container-ButtonGroup-cfg-tools'> /**
168 </span> * @cfg {Array} tools @hide
170 <span id='Ext-container-ButtonGroup-cfg-collapsible'> /**
171 </span> * @cfg {Boolean} collapsible @hide
173 <span id='Ext-container-ButtonGroup-cfg-collapseMode'> /**
174 </span> * @cfg {Boolean} collapseMode @hide
176 <span id='Ext-container-ButtonGroup-cfg-animCollapse'> /**
177 </span> * @cfg {Boolean} animCollapse @hide
179 <span id='Ext-container-ButtonGroup-cfg-closable'> /**
180 </span> * @cfg {Boolean} closable @hide