PDA

View Full Version : [FIXED][3.x] Menu defines events which are already inherited from Component



Animal
17 Jun 2009, 7:32 AM
The code has



initComponent: function(){
if(Ext.isArray(this.initialConfig)){
Ext.apply(this, {items:this.initialConfig});
}
this.addEvents(
/**
* @event beforeshow
* Fires before this menu is displayed
* @param {Ext.menu.Menu} this
*/
'beforeshow',
/**
* @event beforehide
* Fires before this menu is hidden
* @param {Ext.menu.Menu} this
*/
'beforehide',
/**
* @event show
* Fires after this menu is displayed
* @param {Ext.menu.Menu} this
*/
'show',
/**
* @event hide
* Fires after this menu is hidden
* @param {Ext.menu.Menu} this
*/
'hide',
/**
* @event click
* Fires when this menu is clicked (or when the enter key is pressed while it is active)
* @param {Ext.menu.Menu} this
* @param {Ext.menu.Item} menuItem The menu item that was clicked
* @param {Ext.EventObject} e
*/
'click',
/**
* @event mouseover
* Fires when the mouse is hovering over this menu
* @param {Ext.menu.Menu} this
* @param {Ext.EventObject} e
* @param {Ext.menu.Item} menuItem The menu item that was clicked
*/
'mouseover',
/**
* @event mouseout
* Fires when the mouse exits this menu
* @param {Ext.menu.Menu} this
* @param {Ext.EventObject} e
* @param {Ext.menu.Item} menuItem The menu item that was clicked
*/
'mouseout',
/**
* @event itemclick
* Fires when a menu item contained in this menu is clicked
* @param {Ext.menu.BaseItem} baseItem The BaseItem that was clicked
* @param {Ext.EventObject} e
*/
'itemclick'
);
Ext.menu.MenuMgr.register(this);
if(this.floating){
Ext.EventManager.onWindowResize(this.hide, this);
}else{
if(this.initialConfig.hidden !== false){
this.hidden = false;
}
this.internalDefaults = {hideOnClick: false};
}
Ext.menu.Menu.superclass.initComponent.call(this);
if(this.autoLayout){
this.on({
add: this.doLayout,
remove: this.doLayout,
scope: this
});
}
},


The code in red should be removed because it already has those events by virtue of now being a Component.

Also, the code should probably be updated to behave like Components do, allowing returning false from a beforeshow handler to veto a show.

mjlecomte
18 Jun 2009, 9:40 AM
Just an update: this issue appears to be still OPEN as of now, but the plan is to defer this until after the release of 3.0 final.

evant
28 Jun 2009, 11:18 PM
Fixed in SVN.