// select dom element
var e = $(element);
var oldval = e.val(); // oldval: null
// assign new array of objects
e.select2({ data: ko.unwrap(items || [])});
// e.val(): id of the first array item
// as a workaround, i now have to set to oldval
e.val(oldval);
i am using the latest select2 version.
this behavior was changed with the last update.
maybe you could introduce a new option like 'autoassign: false'
to have the old behavior back.
the value of my dropdown can be empty.
i am using this in a dependent dropdown scenario with knockoutjs.
i only want values to be assigned if chosen.
maybe opposite to #2493 or #2196
You can get the old behaviour back by adding a blank option (<option></option>) to your select. This is being done by the browser, not by Select2.
on select2 with thumbnail it tries to get thumbnail image for blank option with the mydomain.com/page/undefined url
Also, you need to set placeholder for the empty option to not show up under dropdown options.
Most helpful comment
You can get the old behaviour back by adding a blank option (
<option></option>) to your select. This is being done by the browser, not by Select2.