X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/src/widgets/Toolbar.js
diff --git a/src/widgets/Toolbar.js b/src/widgets/Toolbar.js
index 97457106..f29394af 100644
--- a/src/widgets/Toolbar.js
+++ b/src/widgets/Toolbar.js
@@ -1,5 +1,5 @@
/*!
- * Ext JS Library 3.0.0
+ * Ext JS Library 3.0.3
* Copyright(c) 2006-2009 Ext JS, LLC
* licensing@extjs.com
* http://www.extjs.com/license
@@ -187,7 +187,7 @@ Ext.layout.ToolbarLayout = Ext.extend(Ext.layout.ContainerLayout, {
clearMenu : function(){
var m = this.moreMenu;
if(m && m.items){
- this.moreMenu.items.each(function(item){
+ m.items.each(function(item){
delete item.menu;
});
}
@@ -230,6 +230,7 @@ Ext.layout.ToolbarLayout = Ext.extend(Ext.layout.ContainerLayout, {
scope: this
}
});
+ this.moreMenu.ownerCt = this.container;
this.more = new Ext.Button({
iconCls: 'x-toolbar-more-icon',
cls: 'x-toolbar-more',
@@ -367,6 +368,15 @@ Ext.extend(T, Ext.Container, {
defaultType: 'button',
+ /**
+ * @cfg {String/Object} layout
+ * This class assigns a default layout (layout:'toolbar'
).
+ * Developers may override this configuration option if another layout
+ * is required (the constructor must be passed a configuration object in this
+ * case instead of an array).
+ * See {@link Ext.Container#layout} for additional information.
+ */
+
trackMenus : true,
internalDefaults: {removeMode: 'container', hideParent: true},
toolbarCls: 'x-toolbar',
@@ -392,12 +402,14 @@ Ext.extend(T, Ext.Container, {
};
}
this.el = ct.createChild(Ext.apply({ id: this.id },this.autoCreate), position);
+ Ext.Toolbar.superclass.onRender.apply(this, arguments);
}
},
/**
- * Adds element(s) to the toolbar -- this function takes a variable number of
- * arguments of mixed type and adds them to the toolbar.
+ *
Adds element(s) to the toolbar -- this function takes a variable number of + * arguments of mixed type and adds them to the toolbar.
+ *Note: See the notes within {@link Ext.Container#add}.
* @param {Mixed} arg1 The following types of arguments are all valid:Note: See the notes within {@link Ext.Container#add}.
* @return {Ext.Toolbar.Item} The separator {@link Ext.Toolbar.Item item} */ addSeparator : function(){ @@ -472,6 +485,7 @@ Ext.extend(T, Ext.Container, { /** * Adds a spacer element + *Note: See the notes within {@link Ext.Container#add}.
* @return {Ext.Toolbar.Spacer} The spacer item */ addSpacer : function(){ @@ -480,6 +494,7 @@ Ext.extend(T, Ext.Container, { /** * Forces subsequent additions into the float:right toolbar + *Note: See the notes within {@link Ext.Container#add}.
*/ addFill : function(){ this.add(new T.Fill()); @@ -487,6 +502,7 @@ Ext.extend(T, Ext.Container, { /** * Adds any standard HTML element to the toolbar + *Note: See the notes within {@link Ext.Container#add}.
* @param {Mixed} el The element or id of the element to add * @return {Ext.Toolbar.Item} The element's item */ @@ -496,15 +512,17 @@ Ext.extend(T, Ext.Container, { /** * Adds any Toolbar.Item or subclass + *Note: See the notes within {@link Ext.Container#add}.
* @param {Ext.Toolbar.Item} item * @return {Ext.Toolbar.Item} The item */ addItem : function(item){ - return Ext.Toolbar.superclass.add.apply(this, arguments); + return this.add.apply(this, arguments); }, /** * Adds a button (or buttons). See {@link Ext.Button} for more info on the config. + *Note: See the notes within {@link Ext.Container#add}.
* @param {Object/Array} config A button config or array of configs * @return {Ext.Button/Array} */ @@ -521,6 +539,7 @@ Ext.extend(T, Ext.Container, { /** * Adds text to the toolbar + *Note: See the notes within {@link Ext.Container#add}.
* @param {String} text The text to add * @return {Ext.Toolbar.Item} The element's item */ @@ -530,6 +549,7 @@ Ext.extend(T, Ext.Container, { /** * Adds a new element to the toolbar from the passed {@link Ext.DomHelper} config + *Note: See the notes within {@link Ext.Container#add}.
* @param {Object} config * @return {Ext.Toolbar.Item} The element's item */ @@ -540,6 +560,7 @@ Ext.extend(T, Ext.Container, { /** * Adds a dynamically rendered Ext.form field (TextField, ComboBox, etc). Note: the field should not have * been rendered yet. For a field that has already been rendered, use {@link #addElement}. + *Note: See the notes within {@link Ext.Container#add}.
* @param {Ext.form.Field} field * @return {Ext.Toolbar.Item} */ @@ -549,6 +570,7 @@ Ext.extend(T, Ext.Container, { /** * Inserts any {@link Ext.Toolbar.Item}/{@link Ext.Button} at the specified index. + *Note: See the notes within {@link Ext.Container#add}.
* @param {Number} index The index where the item is to be inserted * @param {Object/Ext.Toolbar.Item/Ext.Button/Array} item The button, or button config object to be * inserted, or an array of buttons/configs. @@ -750,23 +772,29 @@ new Ext.Panel({ * @xtype tbtext */ T.TextItem = Ext.extend(T.Item, { + /** + * @cfg {String} text The text to be used as innerHTML (html tags are accepted) + */ + constructor: function(config){ - if (Ext.isString(config)) { - config = { autoEl: {cls: 'xtb-text', html: config }}; - } else { - config.autoEl = {cls: 'xtb-text', html: config.text || ''}; - } - T.TextItem.superclass.constructor.call(this, config); + T.TextItem.superclass.constructor.call(this, Ext.isString(config) ? {text: config} : config); + }, + + // private + onRender : function(ct, position) { + this.autoEl = {cls: 'xtb-text', html: this.text || ''}; + T.TextItem.superclass.onRender.call(this, ct, position); }, + /** * Updates this item's text, setting the text to be used as innerHTML. * @param {String} t The text to display (html accepted). */ setText : function(t) { - if (this.rendered) { - this.el.dom.innerHTML = t; - } else { - this.autoEl.html = t; + if(this.rendered){ + this.el.update(t); + }else{ + this.text = t; } } });