0001-forms-keep-hint-as-initial-option-in-dynamic-select-.patch
wcs/qommon/static/js/qommon.forms.js | ||
---|---|---|
104 | 104 |
// replace <select> contents |
105 | 105 |
var $select = $widget.find('select'); |
106 | 106 |
var current_value = $select.val(); |
107 |
var hint = $widget.find('option[data-hint]').data('hint'); |
|
107 | 108 |
$select.empty(); |
109 |
if (hint) { |
|
110 |
var $option = $('<option></option>', {value: '', text: hint}); |
|
111 |
$option.attr('data-hint', hint); |
|
112 |
$option.appendTo($select); |
|
113 |
} |
|
108 | 114 |
for (var i=0; i<value.items.length; i++) { |
109 | 115 |
var $option = $('<option></option>', {value: value.items[i].id, text: value.items[i].text}); |
110 | 116 |
if (value.items[i].id == current_value) { |
111 |
- |