Hi,

PFA patch for switch control.

Issue: Configuration options for switch control from different places
should be merged together and not overridden.


-- 
*Harshal Dhumal*
*Software Engineer *



EenterpriseDB <http://www.enterprisedb.com>
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 66d8dab..ce5cb1a 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -441,19 +441,21 @@
     },
     events: {'switchChange.bootstrapSwitch': 'onChange'},
     render: function() {
-      var field = _.defaults(this.field.toJSON(), this.defaults, {options: $.fn.bootstrapSwitch.defaults}),
+      var field = _.defaults(this.field.toJSON(), this.defaults),
           attributes = this.model.toJSON(),
           attrArr = field.name.split('.'),
           name = attrArr.shift(),
           path = attrArr.join('.'),
-          rawValue = this.keyPathAccessor(attributes[name], path);
+          rawValue = this.keyPathAccessor(attributes[name], path),
+          options =  _.defaults({}, this.field.get('options'), this.defaults.options,
+                        $.fn.bootstrapSwitch.defaults);
 
       Backform.InputControl.prototype.render.apply(this, arguments);
       this.$input = this.$el.find("input[type=checkbox]").first();
 
       //Check & set additional properties
       this.$input.bootstrapSwitch(
-          _.extend(field.options, {'state': rawValue})
+          _.extend(options, {'state': rawValue})
           );
 
       return this;
-- 
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to