X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..6e39d509471fe9b4e2660e0d1631b350d0c66f40:/docs/source/Item.html diff --git a/docs/source/Item.html b/docs/source/Item.html index 0f2f4eb6..ed50c05f 100644 --- a/docs/source/Item.html +++ b/docs/source/Item.html @@ -1,5 +1,6 @@ + The source code @@ -16,13 +17,7 @@ * @param {Object} config Configuration options * @xtype menuitem */ -Ext.menu.Item = function(config){ - Ext.menu.Item.superclass.constructor.call(this, config); - if(this.menu){ - this.menu = Ext.menu.MenuMgr.get(this.menu); - } -}; -Ext.extend(Ext.menu.Item, Ext.menu.BaseItem, { +Ext.menu.Item = Ext.extend(Ext.menu.BaseItem, {
/** * @property menu * @type Ext.menu.Menu @@ -67,6 +62,14 @@ Ext.extend(Ext.menu.Item, Ext.menu.BaseItem, { // private ctype: 'Ext.menu.Item', + initComponent : function(){ + Ext.menu.Item.superclass.initComponent.call(this); + if(this.menu){ + this.menu = Ext.menu.MenuMgr.get(this.menu); + this.menu.ownerCt = this; + } + }, + // private onRender : function(container, position){ if (!this.itemTpl) { @@ -85,6 +88,9 @@ Ext.extend(Ext.menu.Item, Ext.menu.BaseItem, { this.el = position ? this.itemTpl.insertBefore(position, a, true) : this.itemTpl.append(container, a, true); this.iconEl = this.el.child('img.x-menu-item-icon'); this.textEl = this.el.child('.x-menu-item-text'); + if(!this.href) { // if no link defined, prevent the default anchor event + this.mon(this.el, 'click', Ext.emptyFn, null, { preventDefault: true }); + } Ext.menu.Item.superclass.onRender.call(this, container, position); }, @@ -123,10 +129,11 @@ Ext.extend(Ext.menu.Item, Ext.menu.BaseItem, { this.iconEl.replaceClass(oldCls, this.iconCls); } }, - + //private beforeDestroy: function(){ if (this.menu){ + delete this.menu.ownerCt; this.menu.destroy(); } Ext.menu.Item.superclass.beforeDestroy.call(this);