MCPcopy Index your code
hub / github.com/romannurik/AndroidAssetStudio / setOptions

Method setOptions

app/studio/forms/enum-field.js:46–84  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

44 }
45
46 setOptions(options) {
47 if (!this.el_) {
48 return;
49 }
50
51 options = (options || []).map(option =>
52 (typeof option == 'string')
53 ? {id: option, title: String(option)}
54 : option);
55
56 if (this.params_.buttons) {
57 this.el_.empty();
58 (options || []).forEach(option => {
59 $('<input>')
60 .attr({
61 type: 'radio',
62 name: this.getHtmlId(),
63 id: `${this.getHtmlId()}-${option.id}`,
64 value: option.id
65 })
66 .on('change', ev => this.setValueInternal_($(ev.currentTarget).val(), false))
67 .appendTo(this.el_);
68 $('<label>')
69 .attr('for', `${this.getHtmlId()}-${option.id}`)
70 .attr('tabindex', 0)
71 .html(option.title)
72 .appendTo(this.el_);
73 });
74 } else {
75 this.selectEl_.empty();
76 (options || []).forEach(option =>
77 $('<option>')
78 .attr('value', option.id)
79 .text(option.title)
80 .appendTo(this.selectEl_));
81 }
82
83 this.setValueInternal_(this.getValue());
84 }
85
86 getValue() {
87 var value = this.value_;

Callers 2

createUiMethod · 0.95
createUiMethod · 0.80

Calls 3

setValueInternal_Method · 0.95
getValueMethod · 0.95
getHtmlIdMethod · 0.80

Tested by

no test coverage detected