Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / docs / source / RowExpander.html
index f556ccd..63f12e7 100644 (file)
@@ -1,10 +1,10 @@
-<html>\r
-<head>\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
+<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.ns('Ext.ux.grid');\r
 \r
 <div id="cls-Ext.ux.grid.RowExpander"></div>/**\r
@@ -138,10 +138,19 @@ Ext.ux.grid.RowExpander = Ext.extend(Ext.util.Observable, {
     \r
     // @private    \r
     onDestroy: function() {\r
-        this.keyNav.disable();\r
-        delete this.keyNav;\r
+        if(this.keyNav){\r
+            this.keyNav.disable();\r
+            delete this.keyNav;\r
+        }\r
+        /*\r
+         * A majority of the time, the plugin will be destroyed along with the grid,\r
+         * which means the mainBody won't be available. On the off chance that the plugin\r
+         * isn't destroyed with the grid, take care of removing the listener.\r
+         */\r
         var mainBody = this.grid.getView().mainBody;\r
-        mainBody.un('mousedown', this.onMouseDown, this);\r
+        if(mainBody){\r
+            mainBody.un('mousedown', this.onMouseDown, this);\r
+        }\r
     },\r
     // @private\r
     onRowDblClick: function(grid, rowIdx, e) {\r
@@ -229,6 +238,6 @@ Ext.ux.grid.RowExpander = Ext.extend(Ext.util.Observable, {
 Ext.preg('rowexpander', Ext.ux.grid.RowExpander);\r
 \r
 //backwards compat\r
-Ext.grid.RowExpander = Ext.ux.grid.RowExpander;</pre>    \r
-</body>\r
+Ext.grid.RowExpander = Ext.ux.grid.RowExpander;</pre>
+</body>
 </html>
\ No newline at end of file