(elem: JQuery, options: any)
| 61 | } |
| 62 | |
| 63 | setup_select_options(elem: JQuery, options: any) { |
| 64 | let input_elem = elem.find('select'); |
| 65 | let opts = input_elem.find('option'); |
| 66 | for (let idx = 0; idx < options.length; idx++) |
| 67 | opts.eq(idx).val(JSON.stringify(options[idx].value)); |
| 68 | |
| 69 | // 将额外的html参数加到input标签上 |
| 70 | const ignore_keys = make_set(['type', 'label', 'invalid_feedback', 'valid_feedback', 'help_text', |
| 71 | 'options', 'datalist', 'multiple', 'onchange', 'onblur']) |
| 72 | |
| 73 | for (let key in this.spec) { |
| 74 | if (key in ignore_keys) continue; |
| 75 | input_elem.attr(key, this.spec[key]); |
| 76 | } |
| 77 | |
| 78 | if (this.use_bootstrap_select) { |
| 79 | // @ts-ignore |
| 80 | input_elem.selectpicker('refresh'); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | update_input(spec: any): any { |
| 85 | let attributes = spec.attributes; |
no test coverage detected