X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/pkgs/pkg-buttons-debug.js diff --git a/pkgs/pkg-buttons-debug.js b/pkgs/pkg-buttons-debug.js index 86e62405..e9589d54 100644 --- a/pkgs/pkg-buttons-debug.js +++ b/pkgs/pkg-buttons-debug.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 @@ -16,7 +16,6 @@ *
b
: Buttone
: EventObjectWhen a custom {@link #template} is used, you must ensure that this selector results in the selection of * a focussable element.
- *Defaults to "button:first-child".
+ *Defaults to 'button:first-child'.
*/ buttonSelector : 'button:first-child', @@ -141,7 +135,13 @@ Ext.Button = Ext.extend(Ext.BoxComponent, { *Defaults to 'small'.
*/ - scale: 'small', + scale : 'small', + + /** + * @cfg {Object} scope The scope (this reference) in which the + *{@link #handler}
and {@link #toggleHandler}
is
+ * executed. Defaults to this Button.
+ */
/**
* @cfg {String} iconAlign
@@ -333,7 +333,12 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
this.el = btn;
if(this.id){
- this.el.dom.id = this.el.id = this.id;
+ var d = this.el.dom,
+ c = Ext.Element.cache;
+
+ delete c[d.id];
+ d.id = this.el.id = this.id;
+ c[d.id] = this.el;
}
if(this.icon){
btnEl.setStyle('background-image', 'url(' +this.icon +')');
@@ -351,7 +356,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
mouseover: this.onMouseOver,
mousedown: this.onMouseDown
});
-
+
// new functionality for monitoring on the document level
//this.mon(btn, 'mouseout', this.onMouseOut, this);
}
@@ -368,7 +373,6 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
var repeater = new Ext.util.ClickRepeater(btn, Ext.isObject(this.repeat) ? this.repeat : {});
this.mon(repeater, 'click', this.onClick, this);
}
-
this.mon(btn, this.clickEvent, this.onClick, this);
},
@@ -418,16 +422,16 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
}
return this;
},
-
+
// private
- clearTip: function(){
+ clearTip : function(){
if(Ext.isObject(this.tooltip)){
Ext.QuickTips.unregister(this.btnEl);
}
},
-
+
// private
- beforeDestroy: function(){
+ beforeDestroy : function(){
if(this.rendered){
this.clearTip();
}
@@ -466,7 +470,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
/**
* Assigns this Button's click handler
* @param {Function} handler The function to call when the button is clicked
- * @param {Object} scope (optional) Scope for the function passed in
+ * @param {Object} scope (optional) Scope for the function passed in. Defaults to this Button.
* @return {Ext.Button} this
*/
setHandler : function(handler, scope){
@@ -506,7 +510,9 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
toggle : function(state, suppressEvent){
state = state === undefined ? !this.pressed : !!state;
if(state != this.pressed){
- this.el[state ? 'addClass' : 'removeClass']('x-btn-pressed');
+ if(this.rendered){
+ this.el[state ? 'addClass' : 'removeClass']('x-btn-pressed');
+ }
this.pressed = state;
if(!suppressEvent){
this.fireEvent('toggle', this, state);
@@ -534,7 +540,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
onEnable : function(){
this.onDisableChange(false);
},
-
+
onDisableChange : function(disabled){
if(this.el){
if(!Ext.isIE6 || !this.text){
@@ -953,8 +959,8 @@ Ext.CycleButton = Ext.extend(Ext.SplitButton, {
* @param {Boolean} suppressEvent True to prevent the button's change event from firing (defaults to false)
*/
setActiveItem : function(item, suppressEvent){
- if(typeof item != 'object'){
- item = this.menu.items.get(item);
+ if(!Ext.isObject(item)){
+ item = this.menu.getComponent(item);
}
if(item){
if(!this.rendered){
@@ -1011,18 +1017,19 @@ Ext.CycleButton = Ext.extend(Ext.SplitButton, {
this.menu = {cls:'x-cycle-menu', items:[]};
var checked;
- for(var i = 0, len = this.itemCount; i < len; i++){
- var item = this.items[i];
- item.group = item.group || this.id;
- item.itemIndex = i;
- item.checkHandler = this.checkHandler;
- item.scope = this;
- item.checked = item.checked || false;
+ Ext.each(this.items, function(item, i){
+ Ext.apply(item, {
+ group: item.group || this.id,
+ itemIndex: i,
+ checkHandler: this.checkHandler,
+ scope: this,
+ checked: item.checked || false
+ });
this.menu.items.push(item);
if(item.checked){
checked = item;
}
- }
+ }, this);
this.setActiveItem(checked, true);
Ext.CycleButton.superclass.initComponent.call(this);
@@ -1042,13 +1049,18 @@ Ext.CycleButton = Ext.extend(Ext.SplitButton, {
* the active item will be set to the first item in the menu.
*/
toggleSelected : function(){
- this.menu.render();
+ var m = this.menu;
+ m.render();
+ // layout if we haven't before so the items are active
+ if(!m.hasLayout){
+ m.doLayout();
+ }
var nextIdx, checkItem;
for (var i = 1; i < this.itemCount; i++) {
nextIdx = (this.activeItem.itemIndex + i) % this.itemCount;
// check the potential item
- checkItem = this.menu.items.itemAt(nextIdx);
+ checkItem = m.items.itemAt(nextIdx);
// if its not disabled then check it.
if (!checkItem.disabled) {
checkItem.setChecked(true);