2
0
mirror of https://github.com/frappe/books.git synced 2024-09-21 03:39:02 +00:00
books/client/view/controls/select.js
2018-02-08 17:15:32 +05:30

25 lines
677 B
JavaScript

const BaseControl = require('./base');
const frappe = require('frappejs');
class SelectControl extends BaseControl {
makeInput() {
this.input = frappe.ui.add('select', 'form-control', this.formGroup);
let options = this.options;
if (typeof options==='string') {
options = options.split('\n');
}
for (let value of options) {
let option = frappe.ui.add('option', null, this.input);
option.textContent = value;
option.setAttribute('value', value);
}
}
make() {
super.make();
this.input.setAttribute('row', '3');
}
};
module.exports = SelectControl;