[Commits] r2234 - core/trunk/geoext/lib/GeoExt/widgets

commits at geoext.org commits at geoext.org
Wed Jun 30 15:03:40 CEST 2010


Author: ahocevar
Date: 2010-06-30 15:03:40 +0200 (Wed, 30 Jun 2010)
New Revision: 2234

Modified:
   core/trunk/geoext/lib/GeoExt/widgets/LayerLegend.js
Log:
give the LayerLegend a reference to the layerRecord's store - this is required because we register listeners on the store that we need to be able to unregister even if the layerRecord has been removed from the store. r=fredj (closes #300)


Modified: core/trunk/geoext/lib/GeoExt/widgets/LayerLegend.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/LayerLegend.js	2010-06-30 09:31:48 UTC (rev 2233)
+++ core/trunk/geoext/lib/GeoExt/widgets/LayerLegend.js	2010-06-30 13:03:40 UTC (rev 2234)
@@ -45,6 +45,11 @@
      *  Optional css class to use for the layer title labels.
      */
     labelCls: null,
+    
+    /** private: property[layerStore]
+     *  :class:`GeoExt.data.LayerStore`
+     */
+    layerStore: null,
 
     /** private: method[initComponent]
      */
@@ -57,8 +62,10 @@
             cls: 'x-form-item x-form-item-label' +
                 (this.labelCls ? ' ' + this.labelCls : '')
         });
-        this.layerRecord &&
-            this.layerRecord.store.on("update", this.onStoreUpdate, this);
+        if (this.layerRecord && this.layerRecord.store) {
+            this.layerStore = this.layerRecord.store;
+            this.layerStore.on("update", this.onStoreUpdate, this);
+        }
     },
 
     /** private: method[onStoreUpdate]
@@ -115,8 +122,8 @@
     /** private: method[beforeDestroy]
      */
     beforeDestroy: function() {
-        this.layerRecord && this.layerRecord.store &&
-            this.layerRecord.store.un("update", this.onStoreUpdate, this);
+        this.layerStore &&
+            this.layerStore.un("update", this.onStoreUpdate, this);
         GeoExt.LayerLegend.superclass.beforeDestroy.apply(this, arguments);
     }
 



More information about the Commits mailing list