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

commits at geoext.org commits at geoext.org
Thu May 14 19:58:27 CEST 2009


Author: bartvde
Date: 2009-05-14 19:58:26 +0200 (Thu, 14 May 2009)
New Revision: 732

Modified:
   sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js
Log:
more work on ascending

Modified: sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js
===================================================================
--- sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js	2009-05-14 17:44:16 UTC (rev 731)
+++ sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js	2009-05-14 17:58:26 UTC (rev 732)
@@ -96,7 +96,7 @@
      */
     onStoreAdd: function(store, records, index) {
         for (var i=0, len=records.length; i<len; i++) {
-            this.addLegend(records[i]);
+            this.addLegend(records[i], this.ascending);
         }
         this.doLayout();
     },
@@ -122,7 +122,7 @@
     removeLegend: function(record) {
         var legend = this.getComponent(record.get('layer').id);
         if (legend) {
-            this.remove(legend, false);
+            legend.hide();
             this.doLayout();
         }
     },
@@ -133,7 +133,7 @@
      *  :param record: ``Ext.data.Record`` The record object from the layer 
      *      store.
      */
-    addLegend: function(record) {
+    addLegend: function(record, ascending) {
         var layer = record.get('layer');
         // a layer can be excluded from the legend by setting the hideInLegend
         // property to true
@@ -156,7 +156,11 @@
                     mainPanel.add(legend);
                 }
             }
-            this.add(mainPanel);
+            if (ascending || (ascending === undefined)) {
+                this.add(mainPanel);
+            } else {
+                this.insert(0, mainPanel);
+            }
         }
     },
 



More information about the Commits mailing list