私のページには次の選択があります。
<select><option value="1" selected="selected">Caption</option></select>
select2 (v 4.0) init を呼び出します。
city.select2({
ajax: {
url: <...>,
data: <...>,
processResults: <...>,
cache: true
},
escapeMarkup: function(markup){ return markup; },
minimumInputLength: 0,
templateResult: function(repo){ return repo.name; },
templateSelection: function(repo){ return repo.name; }
});
問題は、select2 がデフォルトの選択値をリセットし、空白の文字列を表示していることです。select2 init でデフォルト値を設定する方法はありますか?