2018-01-12 12:25:07 +00:00
|
|
|
const BaseControl = require('./base');
|
2018-02-08 11:45:32 +00:00
|
|
|
const frappe = require('frappejs');
|
2018-01-12 12:25:07 +00:00
|
|
|
|
|
|
|
class SelectControl extends BaseControl {
|
2018-02-08 11:45:32 +00:00
|
|
|
makeInput() {
|
|
|
|
this.input = frappe.ui.add('select', 'form-control', this.formGroup);
|
2018-01-12 12:25:07 +00:00
|
|
|
|
|
|
|
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;
|