var _ = require('underscore'); var SelectMultipleSingleModel = widgets.SelectModel.extend({ defaults: function() { return _.extend({}, widgets.SelectModel.prototype.defaults.apply(this), { _view_name: "SelectMultipleSingleView", _model_name: "SelectMultipleSingleModel", _model_module: 'beakerx', _view_module: 'beakerx' }); } }); var SelectMultipleSingleView = widgets.SelectView.extend({ update: function() { SelectMultipleSingleView.__super__.update.apply(this); var items = this.model.get('_options_labels'); if (items && items.length !== undefined) { $(this.listbox).attr('size', items.length); $(this.el) .removeClass('widget-select') .addClass('widget-select-multiple'); } } }); module.exports = { SelectMultipleSingleModel: SelectMultipleSingleModel, SelectMultipleSingleView: SelectMultipleSingleView };
_model_module: 'beakerx', _view_module: 'beakerx' }); } }); var ComboBoxView = widgets.SelectView.extend({ render: function() { ComboBoxView.__super__.render.apply(this); this.el.classList.add('widget-combobox'); this.$select = $(this.el).find('select'); this.$select.attr('easyform-editable', this.model.get('editable')); this.$select.combobox({ change: this.setValueToModel.bind(this) }); this.update(); }, setValueToModel: function(value) { this.model.set('value', value, { updated_view: this }); this.touch(); } }); module.exports = { ComboBoxModel: ComboBoxModel, ComboBoxView: ComboBoxView };