Fix broken default values in widget browser

This commit is contained in:
Nathan Gray 2013-02-25 18:52:45 +00:00
parent a0c0ddbfbe
commit e38ab3715e

View File

@ -163,25 +163,28 @@ widget_browser.prototype.create_attribute = function(name, settings)
// Setter function - maybe editable? // Setter function - maybe editable?
var self = this; var self = this;
var input = null;
switch(settings.type) switch(settings.type)
{ {
case 'string': case 'string':
value.append('<input/>') input = $j('<input/>')
.change(function(e) { .change(function(e) {
self.widget[set_function_name].apply(self.widget, [$j(e.target).val()]); self.widget[set_function_name].apply(self.widget, [$j(e.target).val()]);
}); });
input.val(this.widget.options[name]);
break; break;
case 'boolean': case 'boolean':
value.append('<input type="checkbox"/>') input = $j('<input type="checkbox"/>')
.attr("checked", this.widget.options[name])
.change(function(e) { .change(function(e) {
self.widget[set_function_name].apply(self.widget, [$j(e.target).val()]); self.widget[set_function_name].apply(self.widget, [e.target.checked]);
}); });
break; break;
default: default:
value.text(this.widget.options[name]); value.text(this.widget.options[name]);
return row; return row;
} }
value.val(this.widget.options[name]); input.appendTo(value)
return row; return row;
} }