Upgrade to ExtJS 3.1.0 - Released 12/16/2009
[extjs.git] / docs / source / AccordionLayout.html
index 6cc5292..fe5486e 100644 (file)
@@ -1,17 +1,12 @@
-<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.layout.AccordionLayout"></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.layout.AccordionLayout"></div>/**\r
  * @class Ext.layout.AccordionLayout\r
  * @extends Ext.layout.FitLayout\r
  * <p>This is a layout that manages multiple Panels in an expandable accordion style such that only\r
@@ -117,7 +112,7 @@ Ext.layout.AccordionLayout = Ext.extend(Ext.layout.FitLayout, {
             c.collapseFirst = this.collapseFirst;\r
         }\r
         if(!this.activeItem && !c.collapsed){\r
-            this.activeItem = c;\r
+            this.setActiveItem(c, true);\r
         }else if(this.activeItem && this.activeItem != c){\r
             c.collapsed = true;\r
         }\r
@@ -150,7 +145,7 @@ Ext.layout.AccordionLayout = Ext.extend(Ext.layout.FitLayout, {
                 ai.collapse(this.animate);\r
             }\r
         }\r
-        this.activeItem = p;\r
+        this.setActive(p);\r
         if(this.activeOnTop){\r
             p.el.dom.parentNode.insertBefore(p.el.dom, p.el.dom.parentNode.firstChild);\r
         }\r
@@ -176,20 +171,29 @@ Ext.layout.AccordionLayout = Ext.extend(Ext.layout.FitLayout, {
      * @param {String/Number} item The string component id or numeric index of the item to activate\r
      */\r
     setActiveItem : function(item){\r
+        this.setActive(item, true);\r
+    },\r
+    \r
+    // private\r
+    setActive : function(item, expand){\r
+        var ai = this.activeItem;\r
         item = this.container.getComponent(item);\r
-        if(this.activeItem != item){\r
-            if(item.rendered && item.collapsed){\r
+        if(ai != item){\r
+            if(item.rendered && item.collapsed && expand){\r
                 item.expand();\r
             }else{\r
+                if(ai){\r
+                   ai.fireEvent('deactivate', ai);\r
+                }\r
                 this.activeItem = item;\r
+                item.fireEvent('activate', item);\r
             }\r
         }\r
-\r
     }\r
 });\r
 Ext.Container.LAYOUTS.accordion = Ext.layout.AccordionLayout;\r
 \r
 //backwards compat\r
-Ext.layout.Accordion = Ext.layout.AccordionLayout;</pre>
-</body>
+Ext.layout.Accordion = Ext.layout.AccordionLayout;</pre>    \r
+</body>\r
 </html>
\ No newline at end of file