Upgrade to ExtJS 3.0.3 - Released 10/11/2009
[extjs.git] / examples / ux / RowExpander.js
index 377089c..4b6e4a4 100644 (file)
@@ -1,5 +1,5 @@
 /*!
- * Ext JS Library 3.0.0
+ * Ext JS Library 3.0.3
  * Copyright(c) 2006-2009 Ext JS, LLC
  * licensing@extjs.com
  * http://www.extjs.com/license
@@ -137,10 +137,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