if(this.rendered){\r
this.clearTip();\r
}\r
- if(this.menu && this.menu.autoDestroy) {\r
+ if(this.menu && this.destroyMenu !== false) {\r
Ext.destroy(this.menu);\r
}\r
Ext.destroy(this.repeater);\r
delete this.btnEl;\r
Ext.ButtonToggleMgr.unregister(this);\r
}\r
+ Ext.Button.superclass.onDestroy.call(this);\r
},\r
\r
// private\r
if(this.tooltip){\r
Ext.QuickTips.getQuickTip().cancelShow(this.btnEl);\r
}\r
+ if(this.menu.isVisible()){\r
+ this.menu.hide();\r
+ }\r
+ this.menu.ownerCt = this;\r
this.menu.show(this.el, this.menuAlign);\r
}\r
return this;\r
* Hide this button's menu (if it has one)\r
*/\r
hideMenu : function(){\r
- if(this.menu){\r
+ if(this.hasVisibleMenu()){\r
this.menu.hide();\r
}\r
return this;\r
* @return {Boolean}\r
*/\r
hasVisibleMenu : function(){\r
- return this.menu && this.menu.isVisible();\r
+ return this.menu && this.menu.ownerCt == this && this.menu.isVisible();\r
},\r
\r
// private\r
if(this.enableToggle && (this.allowDepress !== false || !this.pressed)){\r
this.toggle();\r
}\r
- if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){\r
+ if(this.menu && !this.hasVisibleMenu() && !this.ignoreNextClick){\r
this.showMenu();\r
}\r
this.fireEvent('click', this, e);\r
},\r
// private\r
onMenuShow : function(e){\r
- this.menu.ownerCt = this;\r
- this.ignoreNextClick = 0;\r
- this.el.addClass('x-btn-menu-active');\r
- this.fireEvent('menushow', this, this.menu);\r
+ if(this.menu.ownerCt == this){\r
+ this.menu.ownerCt = this;\r
+ this.ignoreNextClick = 0;\r
+ this.el.addClass('x-btn-menu-active');\r
+ this.fireEvent('menushow', this, this.menu);\r
+ }\r
},\r
// private\r
onMenuHide : function(e){\r
- this.el.removeClass('x-btn-menu-active');\r
- this.ignoreNextClick = this.restoreClick.defer(250, this);\r
- this.fireEvent('menuhide', this, this.menu);\r
- delete this.menu.ownerCt;\r
+ if(this.menu.ownerCt == this){\r
+ this.el.removeClass('x-btn-menu-active');\r
+ this.ignoreNextClick = this.restoreClick.defer(250, this);\r
+ this.fireEvent('menuhide', this, this.menu);\r
+ delete this.menu.ownerCt;\r
+ }\r
},\r
\r
// private\r
/**\r
* @cfg {String} autoEl @hide\r
*/\r
+ /**\r
+ * @cfg {String/Object} html @hide\r
+ */\r
+ /**\r
+ * @cfg {String} contentEl @hide\r
+ */\r
+ /**\r
+ * @cfg {Mixed} data @hide\r
+ */\r
+ /**\r
+ * @cfg {Mixed} tpl @hide\r
+ */\r
+ /**\r
+ * @cfg {String} tplWriteMode @hide\r
+ */\r
});\r
Ext.reg('button', Ext.Button);\r
\r