/*!
- * Ext JS Library 3.2.2
+ * Ext JS Library 3.3.0
* Copyright(c) 2006-2010 Ext JS, Inc.
* licensing@extjs.com
* http://www.extjs.com/license
var items = this.items;
for(var i = start, len = items.length; i >= 0 && i < len; i+= step){
var item = items.get(i);
- if(!item.disabled && (item.canActivate || item.isFormField)){
+ if(item.isVisible() && !item.disabled && (item.canActivate || item.isFormField)){
this.setActiveItem(item, false);
return item;
}
return c;
},
- applyDefaults : function(c){
- if(!Ext.isString(c)){
+ applyDefaults : function(c) {
+ if (!Ext.isString(c)) {
c = Ext.menu.Menu.superclass.applyDefaults.call(this, c);
var d = this.internalDefaults;
if(d){
},
// private
- getMenuItem : function(config){
- if(!config.isXType){
- if(!config.xtype && Ext.isBoolean(config.checked)){
- return new Ext.menu.CheckItem(config)
+ getMenuItem : function(config) {
+ if (!config.isXType) {
+ if (!config.xtype && Ext.isBoolean(config.checked)) {
+ return new Ext.menu.CheckItem(config);
}
return Ext.create(config, this.defaultType);
}
* Adds a separator bar to the menu
* @return {Ext.menu.Item} The menu item that was added
*/
- addSeparator : function(){
+ addSeparator : function() {
return this.add(new Ext.menu.Separator());
},
* @param {Mixed} el The element or DOM node to add, or its id
* @return {Ext.menu.Item} The menu item that was added
*/
- addElement : function(el){
+ addElement : function(el) {
return this.add(new Ext.menu.BaseItem({
el: el
}));
* @param {Ext.menu.Item} item The menu item to add
* @return {Ext.menu.Item} The menu item that was added
*/
- addItem : function(item){
+ addItem : function(item) {
return this.add(item);
},
* @param {Object} config A MenuItem config object
* @return {Ext.menu.Item} The menu item that was added
*/
- addMenuItem : function(config){
+ addMenuItem : function(config) {
return this.add(this.getMenuItem(config));
},
}
}
- // private
- function onBeforeCheck(mi, state){
- if(state){
- var g = groups[mi.group];
- for(var i = 0, l = g.length; i < l; i++){
- if(g[i] != mi){
- g[i].setChecked(false);
- }
- }
- }
- }
-
return {
/**
groups[g] = [];
}
groups[g].push(menuItem);
- menuItem.on("beforecheckchange", onBeforeCheck);
}
},
var g = menuItem.group;
if(g){
groups[g].remove(menuItem);
- menuItem.un("beforecheckchange", onBeforeCheck);
+ }
+ },
+
+ // private
+ onCheckChange: function(item, state){
+ if(item.group && state){
+ var group = groups[item.group],
+ i = 0,
+ len = group.length,
+ current;
+
+ for(; i < len; i++){
+ current = group[i];
+ if(current != item){
+ current.setChecked(false);
+ }
+ }
}
},
*/
itemCls : "x-menu-text",
- constructor : function(config){
- if(typeof config == 'string'){
- config = {text: config}
+ constructor : function(config) {
+ if (typeof config == 'string') {
+ config = {
+ text: config
+ };
}
Ext.menu.TextItem.superclass.constructor.call(this, config);
},
// private
- onRender : function(){
+ onRender : function() {
var s = document.createElement("span");
s.className = this.itemCls;
s.innerHTML = this.text;
* @cfg {Number} showDelay Length of time in milliseconds to wait before showing this item (defaults to 200)
*/
showDelay: 200,
+
+ /**
+ * @cfg {String} altText The altText to use for the icon, if it exists. Defaults to <tt>''</tt>.
+ */
+ altText: '',
+
// doc'd in BaseItem
hideDelay: 200,
' target="{hrefTarget}"',
'</tpl>',
'>',
- '<img src="{icon}" class="x-menu-item-icon {iconCls}"/>',
+ '<img alt="{altText}" src="{icon}" class="x-menu-item-icon {iconCls}"/>',
'<span class="x-menu-item-text">{text}</span>',
'</a>'
);
hrefTarget: this.hrefTarget,
icon: this.icon || Ext.BLANK_IMAGE_URL,
iconCls: this.iconCls || '',
- text: this.itemText||this.text||' '
+ text: this.itemText||this.text||' ',
+ altText: this.altText || ''
};
},
/**
* @cfg {Boolean} checked True to initialize this checkbox as checked (defaults to false). Note that
- * if this checkbox is part of a radio group (group = true) only the last item in the group that is
+ * if this checkbox is part of a radio group (group = true) only the first item in the group that is
* initialized with checked = true will be rendered as checked.
*/
checked: false,
setChecked : function(state, suppressEvent){
var suppress = suppressEvent === true;
if(this.checked != state && (suppress || this.fireEvent("beforecheckchange", this, state) !== false)){
+ Ext.menu.MenuMgr.onCheckChange(this, state);
if(this.container){
this.container[state ? "addClass" : "removeClass"]("x-menu-item-checked");
}