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

commits at geoext.org commits at geoext.org
Thu May 14 20:02:49 CEST 2009


Author: bartvde
Date: 2009-05-14 20:02:49 +0200 (Thu, 14 May 2009)
New Revision: 733

Modified:
   sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js
Log:
made the ascending implementation easier

Modified: sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js
===================================================================
--- sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js	2009-05-14 17:58:26 UTC (rev 732)
+++ sandbox/bartvde/legend/geoext/lib/GeoExt/widgets/LegendPanel.js	2009-05-14 18:02:49 UTC (rev 733)
@@ -70,13 +70,7 @@
         if(!this.layerStore) {
             this.layerStore = GeoExt.MapPanel.guess().layers;
         }
-        if (this.ascending) {
-            this.layerStore.each(this.addLegend, this);
-        } else {
-            for (var i=this.layerStore.data.items.length-1; i>=0; i--) {
-                this.addLegend(this.layerStore.data.items[i]);
-            }
-        }
+        this.layerStore.each(this.addLegend, this);
         this.layerStore.on({
             "add": this.onStoreAdd,
             "remove": this.onStoreRemove,
@@ -96,7 +90,7 @@
      */
     onStoreAdd: function(store, records, index) {
         for (var i=0, len=records.length; i<len; i++) {
-            this.addLegend(records[i], this.ascending);
+            this.addLegend(records[i]);
         }
         this.doLayout();
     },
@@ -133,7 +127,7 @@
      *  :param record: ``Ext.data.Record`` The record object from the layer 
      *      store.
      */
-    addLegend: function(record, ascending) {
+    addLegend: function(record) {
         var layer = record.get('layer');
         // a layer can be excluded from the legend by setting the hideInLegend
         // property to true
@@ -156,7 +150,7 @@
                     mainPanel.add(legend);
                 }
             }
-            if (ascending || (ascending === undefined)) {
+            if (this.ascending) {
                 this.add(mainPanel);
             } else {
                 this.insert(0, mainPanel);



More information about the Commits mailing list