X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..25ef3491bd9ae007ff1fc2b0d7943e6eaaccf775:/docs/source/CycleButton.html diff --git a/docs/source/CycleButton.html b/docs/source/CycleButton.html index 777d7a18..7abc37f2 100644 --- a/docs/source/CycleButton.html +++ b/docs/source/CycleButton.html @@ -1,11 +1,17 @@ - - - The source code - - - - -
/** + + + The source code + + + + +
/*!
+ * Ext JS Library 3.0.3
+ * Copyright(c) 2006-2009 Ext JS, LLC
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+
/** * @class Ext.CycleButton * @extends Ext.SplitButton * A specialized SplitButton that contains a menu of {@link Ext.menu.CheckItem} elements. The button automatically @@ -82,8 +88,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){ @@ -140,18 +146,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); @@ -171,13 +178,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); @@ -186,6 +198,6 @@ Ext.CycleButton = Ext.extend(Ext.SplitButton, { } } }); -Ext.reg('cycle', Ext.CycleButton);
- +Ext.reg('cycle', Ext.CycleButton);
+ \ No newline at end of file