-<html>
-<head>
- <title>The source code</title>
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
-</head>
-<body onload="prettyPrint();">
- <pre class="prettyprint lang-js">/*!
- * Ext JS Library 3.0.3
- * Copyright(c) 2006-2009 Ext JS, LLC
- * licensing@extjs.com
- * http://www.extjs.com/license
- */
-<div id="cls-Ext.menu.Item"></div>/**\r
+<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
+</head>\r
+<body onload="prettyPrint();">\r
+ <pre class="prettyprint lang-js"><div id="cls-Ext.menu.Item"></div>/**\r
* @class Ext.menu.Item\r
* @extends Ext.menu.BaseItem\r
* A base class for all menu items that require menu-related functionality (like sub-menus) and are not static\r
* @param {Object} config Configuration options\r
* @xtype menuitem\r
*/\r
-Ext.menu.Item = function(config){\r
- Ext.menu.Item.superclass.constructor.call(this, config);\r
- if(this.menu){\r
- this.menu = Ext.menu.MenuMgr.get(this.menu);\r
- }\r
-};\r
-Ext.extend(Ext.menu.Item, Ext.menu.BaseItem, {\r
+Ext.menu.Item = Ext.extend(Ext.menu.BaseItem, {\r
<div id="prop-Ext.menu.Item-menu"></div>/**\r
* @property menu\r
* @type Ext.menu.Menu\r
// private\r
ctype: 'Ext.menu.Item',\r
\r
+ initComponent : function(){\r
+ Ext.menu.Item.superclass.initComponent.call(this);\r
+ if(this.menu){\r
+ this.menu = Ext.menu.MenuMgr.get(this.menu);\r
+ this.menu.ownerCt = this;\r
+ }\r
+ },\r
+\r
// private\r
onRender : function(container, position){\r
if (!this.itemTpl) {\r
this.el = position ? this.itemTpl.insertBefore(position, a, true) : this.itemTpl.append(container, a, true);\r
this.iconEl = this.el.child('img.x-menu-item-icon');\r
this.textEl = this.el.child('.x-menu-item-text');\r
+ if(!this.href) { // if no link defined, prevent the default anchor event\r
+ this.mon(this.el, 'click', Ext.emptyFn, null, { preventDefault: true });\r
+ }\r
Ext.menu.Item.superclass.onRender.call(this, container, position);\r
},\r
\r
this.iconEl.replaceClass(oldCls, this.iconCls);\r
}\r
},\r
- \r
+\r
//private\r
beforeDestroy: function(){\r
if (this.menu){\r
+ delete this.menu.ownerCt;\r
this.menu.destroy();\r
}\r
Ext.menu.Item.superclass.beforeDestroy.call(this);\r
}\r
}\r
});\r
-Ext.reg('menuitem', Ext.menu.Item);</pre>
-</body>
+Ext.reg('menuitem', Ext.menu.Item);</pre> \r
+</body>\r
</html>
\ No newline at end of file