cartodb-4.42/lib/assets/javascripts/builder/components/form-components/form.js

35 lines
727 B
JavaScript
Raw Normal View History

2024-04-06 13:25:13 +08:00
var Backbone = require('backbone');
Backbone.Form = Backbone.Form.extend({
initialize: function (options) {
this.options = options;
Backbone.Form.Original.prototype.initialize.call(this, options);
},
createField: function (key, schema) {
var options = {
form: this,
key: key,
schema: schema,
idPrefix: this.idPrefix,
trackingClass: this.options.trackingClass
};
if (this.model) {
options.model = this.model;
} else if (this.data) {
options.value = this.data[key];
} else {
options.value = undefined;
}
var field = new this.Field(options);
this.listenTo(field.editor, 'all', this.handleEditorEvent);
return field;
}
});