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

commits at geoext.org commits at geoext.org
Wed Aug 26 00:20:05 CEST 2009


Author: tschaub
Date: 2009-08-26 00:20:05 +0200 (Wed, 26 Aug 2009)
New Revision: 1337

Modified:
   core/trunk/geoext/lib/GeoExt/widgets/ZoomSlider.js
Log:
Binding the zoom slider to a map after it has rendered.  Andreas did all the debugging here and provided a patch.  Bart and I reviewed and decided it was good to commit.  I'm making some changes here to support both Ext 2 and 3.  We may want to revisit the Ext 2 specific solution.  r=bartvde,me (closes #148)

Modified: core/trunk/geoext/lib/GeoExt/widgets/ZoomSlider.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/widgets/ZoomSlider.js	2009-08-24 11:25:46 UTC (rev 1336)
+++ core/trunk/geoext/lib/GeoExt/widgets/ZoomSlider.js	2009-08-25 22:20:05 UTC (rev 1337)
@@ -132,6 +132,24 @@
      *  Called by a MapPanel if this component is one of the items in the panel.
      */
     addToMapPanel: function(panel) {
+        /**
+         * TODO: Remove this when we drop support for Ext 2.
+         * We need special treatment for Ext 2 because components don't have
+         * the "afterrender" event.  Here we wait until the render sequence
+         * finishes before binding the component to the map.
+         */
+        // START SPECIAL TREATMENT FOR EXT 2
+        if (!this.events.afterrender) {
+            this.on({
+                render: function() {
+                    window.setTimeout(
+                        this.bind.createDelegate(this, [panel.map]), 0
+                    );
+                },
+                scope: this
+            });
+        }
+        // END SPECIAL TREATMENT FOR EXT 2
         this.on({
             render: function() {
                 var el = this.getEl();
@@ -144,9 +162,11 @@
                     click: this.stopMouseEvents
                 });
             },
+            afterrender: function() {
+                this.bind(panel.map);
+            },
             scope: this
         });
-        this.bind(panel.map);
     },
     
     /** private: method[stopMouseEvents]
@@ -180,6 +200,7 @@
         });
         if(this.map.baseLayer) {
             this.initZoomValues();
+            this.update();
         }
     },
     



More information about the Commits mailing list