[Commits] r2097 - in sandbox/pgiraud/playground/print-multipage/geoext: lib/GeoExt/plugins tests/lib/GeoExt/plugins

commits at geoext.org commits at geoext.org
Tue Apr 20 09:34:57 CEST 2010


Author: pgiraud
Date: 2010-04-20 09:34:57 +0200 (Tue, 20 Apr 2010)
New Revision: 2097

Modified:
   sandbox/pgiraud/playground/print-multipage/geoext/lib/GeoExt/plugins/PrintPageField.js
   sandbox/pgiraud/playground/print-multipage/geoext/tests/lib/GeoExt/plugins/PrintPageField.html
Log:
fixes the empty fields (scale and rotation) issue, see #267

Modified: sandbox/pgiraud/playground/print-multipage/geoext/lib/GeoExt/plugins/PrintPageField.js
===================================================================
--- sandbox/pgiraud/playground/print-multipage/geoext/lib/GeoExt/plugins/PrintPageField.js	2010-04-19 18:50:41 UTC (rev 2096)
+++ sandbox/pgiraud/playground/print-multipage/geoext/lib/GeoExt/plugins/PrintPageField.js	2010-04-20 07:34:57 UTC (rev 2097)
@@ -111,6 +111,8 @@
             "layoutchange": this.onLayoutChange,
             scope: this
         });
+
+        this.setValue(this.printPage);
     },
 
     /** private: method[onFieldChange]
@@ -141,14 +143,7 @@
      */
     onPageChange: function(printPage) {
         if(!this._updating) {
-            var t = this.target;
-            t.suspendEvents();
-            if(t.store === printPage.printProvider.scales) {
-                t.setValue(printPage.scale.get(t.displayField));
-            } else if(t.name == "rotation") {
-                t.setValue(printPage.rotation);
-            }
-            t.resumeEvents();
+            this.setValue(printPage);
         }
     },
     
@@ -162,6 +157,23 @@
         var t = this.target;
         t.name == "rotation" && t.setDisabled(!layout.get("rotation"));
     },
+
+    /** private: method[setValue]
+     *
+     * Sets the value for the field
+     */
+    setValue: function(printPage) {
+        var t = this.target;
+        t.suspendEvents();
+        if(t.store === printPage.printProvider.scales
+            && printPage.scale !== null) {
+            t.setValue(printPage.scale.get(t.displayField));
+        } else if(t.name == "rotation"
+            && printPage.rotation !== null) {
+            t.setValue(printPage.rotation);
+        }
+        t.resumeEvents();
+    },
     
     /** private: method[destroy]
      */

Modified: sandbox/pgiraud/playground/print-multipage/geoext/tests/lib/GeoExt/plugins/PrintPageField.html
===================================================================
--- sandbox/pgiraud/playground/print-multipage/geoext/tests/lib/GeoExt/plugins/PrintPageField.html	2010-04-19 18:50:41 UTC (rev 2096)
+++ sandbox/pgiraud/playground/print-multipage/geoext/tests/lib/GeoExt/plugins/PrintPageField.html	2010-04-20 07:34:57 UTC (rev 2097)
@@ -25,7 +25,9 @@
             var field = {
                 on: function(cfg) {
                     log.on = cfg;
-                }
+                },
+                suspendEvents: Ext.emptyFn,
+                resumeEvents: Ext.emptyFn
             };
             plugin.init(field);
             



More information about the Commits mailing list