X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..92c2b89db26be16707f4a805d3303ab2531006e1:/docs/source/CycleButton.html?ds=inline
diff --git a/docs/source/CycleButton.html b/docs/source/CycleButton.html
index 777d7a18..1b14352c 100644
--- a/docs/source/CycleButton.html
+++ b/docs/source/CycleButton.html
@@ -1,5 +1,6 @@
+
The source code
@@ -82,8 +83,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){
@@ -98,7 +99,7 @@ Ext.CycleButton = Ext.extend(Ext.SplitButton, {
}
this.activeItem = item;
if(!item.checked){
- item.setChecked(true, true);
+ item.setChecked(true, false);
}
if(this.forceIcon){
this.setIconClass(this.forceIcon);
@@ -139,23 +140,23 @@ Ext.CycleButton = Ext.extend(Ext.SplitButton, {
this.itemCount = this.items.length;
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;
+ var checked = 0;
+ 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;
+ checked = i;
}
- }
- this.setActiveItem(checked, true);
+ }, this);
Ext.CycleButton.superclass.initComponent.call(this);
-
this.on('click', this.toggleSelected, this);
+ this.setActiveItem(checked, true);
},
// private
@@ -171,13 +172,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);