dual-data-picker
Version:
## Settings editableDiv : true This use div instead input. Usefull to eliminate autocomplete feature.
54 lines (37 loc) • 973 B
JavaScript
export default class Select {
constructor(selectId, app) {
this.app = app;
this._selectEl = false;
this._selectId = selectId;
}
get options() {
let select = this.selectEl;
return select.options;
}
select(v) {
this.select_deselect(v, true);
}
deselect(v) {
this.select_deselect(v, false);
}
select_deselect(v, s) {
let options = this.options;
for (let option of options) {
if (option.value == v) {
option.selected = s;
}
}
}
get selectEl() {
if (this._selectEl == false) {
this._selectEl = document.getElementById(this.selectId);
}
return this._selectEl;
}
set selectId(v) {
this._selectId = v;
}
get selectId() {
return this._selectId;
}
}