I cannot get the select2 dropdown to fit parent container (collapse) when initialized hidden. I understand this is not a bug, because select2 was not able to calculate the parent width. But I couldn't overcome this. I need it to be 100% to the parent.
<div class="panel panel-default">
<div class="panel-body">
<div class="btn-toolbar">
<button class="btn btn-default" data-toggle="collapse" data-target="#collapse-select2" aria-expanded="false">Toggle</button>
</div>
<div class="collapse" id="collapse-select2">
<select class="form-control" data-role="select2">
<option value="1">Option #1</option>
<option value="2">Option #2</option>
<option value="3">Option #3</option>
</select>
</div>
</div>
</div>
Fiddle: here
Can anybody please help?