Upgrade to ExtJS 3.1.1 - Released 02/08/2010
[extjs.git] / docs / source / Button.html
index 91c997d..c2ff572 100644 (file)
@@ -438,7 +438,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
         if(this.rendered){\r
             this.clearTip();\r
         }\r
         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
             Ext.destroy(this.menu);\r
         }\r
         Ext.destroy(this.repeater);\r
@@ -453,6 +453,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
             delete this.btnEl;\r
             Ext.ButtonToggleMgr.unregister(this);\r
         }\r
             delete this.btnEl;\r
             Ext.ButtonToggleMgr.unregister(this);\r
         }\r
+        Ext.Button.superclass.onDestroy.call(this);\r
     },\r
 \r
     // private\r
     },\r
 \r
     // private\r
@@ -583,6 +584,10 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
             if(this.tooltip){\r
                 Ext.QuickTips.getQuickTip().cancelShow(this.btnEl);\r
             }\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
             this.menu.show(this.el, this.menuAlign);\r
         }\r
         return this;\r
@@ -592,7 +597,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
      * Hide this button's menu (if it has one)\r
      */\r
     hideMenu : function(){\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
             this.menu.hide();\r
         }\r
         return this;\r
@@ -603,7 +608,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
      * @return {Boolean}\r
      */\r
     hasVisibleMenu : function(){\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
     },\r
 \r
     // private\r
@@ -618,7 +623,7 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
             if(this.enableToggle && (this.allowDepress !== false || !this.pressed)){\r
                 this.toggle();\r
             }\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
                 this.showMenu();\r
             }\r
             this.fireEvent('click', this, e);\r
@@ -718,17 +723,21 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
     },\r
     // private\r
     onMenuShow : function(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
     },\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
 \r
     // private\r
@@ -739,6 +748,21 @@ Ext.Button = Ext.extend(Ext.BoxComponent, {
     /**\r
      * @cfg {String} autoEl @hide\r
      */\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
 });\r
 Ext.reg('button', Ext.Button);\r
 \r