[Commits] r2314 - sandbox/camptocamp/geobretagne/lib/GeoExt/plugins

commits at geoext.org commits at geoext.org
Fri Sep 3 18:44:34 CEST 2010


Author: bbinet
Date: 2010-09-03 18:44:34 +0200 (Fri, 03 Sep 2010)
New Revision: 2314

Modified:
   sandbox/camptocamp/geobretagne/lib/GeoExt/plugins/PrintPageField.js
Log:
add support for checkboxes in PrintPageField

Modified: sandbox/camptocamp/geobretagne/lib/GeoExt/plugins/PrintPageField.js
===================================================================
--- sandbox/camptocamp/geobretagne/lib/GeoExt/plugins/PrintPageField.js	2010-09-03 08:51:30 UTC (rev 2313)
+++ sandbox/camptocamp/geobretagne/lib/GeoExt/plugins/PrintPageField.js	2010-09-03 16:44:34 UTC (rev 2314)
@@ -100,8 +100,13 @@
     init: function(target) {
         this.target = target;
         var onCfg = {scope: this};
-        onCfg[target instanceof Ext.form.ComboBox ? "select" : "valid"] =
-            this.onFieldChange;
+        if (target instanceof Ext.form.Checkbox) {
+            onCfg["check"] = this.onCheckChange;
+        }
+        else {
+            onCfg[target instanceof Ext.form.ComboBox ? "select" : "valid"] =
+                this.onFieldChange;
+        }
         target.on(onCfg);
         this.printPage.on({
             "change": this.onPageChange,
@@ -134,6 +139,19 @@
         delete this._updating;
     },
 
+    /** private: method[onCheckChange]
+     *  :param cp: ``Ext.form.Checkbox``
+     *  :param checked: ``Boolean``
+     *  
+     *  Handler for the target checkbox's "check" event.
+     */
+    onCheckChange: function(cb, checked) {
+        var printProvider = this.printPage.printProvider;
+        this._updating = true;
+        this.printPage.customParams[cb.name] = checked;
+        delete this._updating;
+    },
+
     /** private: method[onPageChange]
      *  :param printPage: :class:`GeoExt.data.PrintPage`
      *  
@@ -178,6 +196,7 @@
     /** private: method[destroy]
      */
     destroy: function() {
+        this.target.un("check", this.onCheckChange, this);
         this.target.un("select", this.onFieldChange, this);
         this.target.un("valid", this.onFieldChange, this);
         this.printPage.un("change", this.onPageChange, this);



More information about the Commits mailing list