[Commits] r758 - sandbox/bartvde/legend/geoext/lib/GeoExt/widgets

commits at geoext.org commits at geoext.org
Fri May 15 15:23:53 CEST 2009


Author: bartvde
Date: 2009-05-15 15:23:53 +0200 (Fri, 15 May 2009)
New Revision: 758

Modified:
   sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js
Log:
few updates on LegendPanel

Modified: sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js
===================================================================
--- sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js	2009-05-15 13:22:34 UTC (rev 757)
+++ sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js	2009-05-15 13:23:53 UTC (rev 758)
@@ -103,12 +103,10 @@
      *  :param operation: ``String`` The type of operation.
      */
     onStoreUpdate: function(store, record, operation) {
-        var legend = this.getComponent(record.get('layer').id);
         var layer = record.get('layer');
-        if (!layer.getVisibility() || record.get('hideInLegend')) {
-            legend.hide();
-        } else {
-            legend.show();
+        var legend = this.getComponent(layer.id);
+        if (legend) {
+            legend.setVisible(layer.getVisibility() && !record.get('hideInLegend'));
         }
     },
 
@@ -226,14 +224,12 @@
         // a layer can be excluded from the legend by setting the hideInLegend
         // property to true
         var hideInLegend = record.get('hideInLegend');
-        // only show visible layers
-        if (layer && layer.getVisibility() && !hideInLegend) {
-            var legendSubpanel = this.createLegendSubpanel(record);
-            if (this.ascending) {
-                this.add(legendSubpanel);
-            } else {
-                this.insert(0, legendSubpanel);
-            }
+        var legendSubpanel = this.createLegendSubpanel(record);
+        legendSubpanel.setVisible((layer && layer.getVisibility() && !hideInLegend));
+        if (this.ascending) {
+            this.add(legendSubpanel);
+        } else {
+            this.insert(0, legendSubpanel);
         }
     },
 



More information about the Commits mailing list