<html>\r
<head>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \r
<title>The source code</title>\r
<link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
<script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
* @param {Boolean} suppressEvent True to prevent the button's change event from firing (defaults to false)\r
*/\r
setActiveItem : function(item, suppressEvent){\r
- if(typeof item != 'object'){\r
- item = this.menu.items.get(item);\r
+ if(!Ext.isObject(item)){\r
+ item = this.menu.getComponent(item);\r
}\r
if(item){\r
if(!this.rendered){\r
\r
this.menu = {cls:'x-cycle-menu', items:[]};\r
var checked;\r
- for(var i = 0, len = this.itemCount; i < len; i++){\r
- var item = this.items[i];\r
- item.group = item.group || this.id;\r
- item.itemIndex = i;\r
- item.checkHandler = this.checkHandler;\r
- item.scope = this;\r
- item.checked = item.checked || false;\r
+ Ext.each(this.items, function(item, i){\r
+ Ext.apply(item, {\r
+ group: item.group || this.id,\r
+ itemIndex: i,\r
+ checkHandler: this.checkHandler,\r
+ scope: this,\r
+ checked: item.checked || false\r
+ });\r
this.menu.items.push(item);\r
if(item.checked){\r
checked = item;\r
}\r
- }\r
+ }, this);\r
this.setActiveItem(checked, true);\r
Ext.CycleButton.superclass.initComponent.call(this);\r
\r
* the active item will be set to the first item in the menu.\r
*/\r
toggleSelected : function(){\r
- this.menu.render();\r
+ var m = this.menu;\r
+ m.render();\r
+ // layout if we haven't before so the items are active\r
+ if(!m.hasLayout){\r
+ m.doLayout();\r
+ }\r
\r
var nextIdx, checkItem;\r
for (var i = 1; i < this.itemCount; i++) {\r
nextIdx = (this.activeItem.itemIndex + i) % this.itemCount;\r
// check the potential item\r
- checkItem = this.menu.items.itemAt(nextIdx);\r
+ checkItem = m.items.itemAt(nextIdx);\r
// if its not disabled then check it.\r
if (!checkItem.disabled) {\r
checkItem.setChecked(true);\r