Projet

Général

Profil

0001-forms-keep-hint-as-initial-option-in-dynamic-select-.patch

Frédéric Péters, 02 novembre 2019 14:45

Télécharger (1,26 ko)

Voir les différences:

Subject: [PATCH] forms: keep hint as initial option in dynamic <select>
 (#37301)

 wcs/qommon/static/js/qommon.forms.js | 6 ++++++
 1 file changed, 6 insertions(+)
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
-