diff --git a/src/editors/select.js b/src/editors/select.js index ee5473b6d..b1c004513 100644 --- a/src/editors/select.js +++ b/src/editors/select.js @@ -16,6 +16,7 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({ if(this.select2) this.select2.select2('val',this.input.value); this.value = sanitized; this.onChange(); + this.change(); }, register: function() { this._super(); @@ -63,7 +64,7 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({ // Enum options enumerated if(this.schema["enum"]) { var display = this.schema.options && this.schema.options.enum_titles || []; - + $each(this.schema["enum"],function(i,option) { self.enum_options[i] = ""+option; self.enum_display[i] = ""+(display[i] || option); @@ -75,20 +76,20 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({ self.enum_options.unshift('undefined'); self.enum_values.unshift(undefined); } - + } // Boolean else if(this.schema.type === "boolean") { self.enum_display = this.schema.options && this.schema.options.enum_titles || ['true','false']; self.enum_options = ['1','']; self.enum_values = [true,false]; - + if(!this.isRequired()){ self.enum_display.unshift(' '); self.enum_options.unshift('undefined'); self.enum_values.unshift(undefined); } - + } // Dynamic Enum else if(this.schema.enumSource) { @@ -96,7 +97,7 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({ this.enum_display = []; this.enum_options = []; this.enum_values = []; - + // Shortcut declaration for using a single array if(!(Array.isArray(this.schema.enumSource))) { if(this.schema.enumValue) { @@ -132,7 +133,7 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({ } } } - + // Now, enumSource is an array of sources // Walk through this array and fix up the values for(i=0; i