mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Configuration options for switch control from different places should be merged together and not overridden.
This commit is contained in:
committed by
Dave Page
parent
06c0cf607d
commit
8189b39b1e
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user