My Select2 control is inside column with bootstrap class 'col-sm-3'. Also it is attached to form field. But width does not want to be 100% of parent column. If I make browser window smaller (after columns auto-rearangment) Select2 follows width of the parent column. Also if I specify width in px it changes the width. What could be a problem? Same story for form->field->textInput. Also I found the field width does not follow parent column width if the form is inline.
<?= $form->field($model, 'categories')->widget(Select2::className(), [
'data' => Category::availableCategories(),
'model' => $model,
'attribute' => 'categories',
'theme' => Select2::THEME_KRAJEE,
'size' => Select2::MEDIUM,
'showToggleAll' => false,
'language' => 'en',
'options' => ['placeholder' => 'Select a category...', 'id' => 'myselect'],
'pluginOptions' => [
'allowClear' => true,
'multiple' => true,
'width' => '200px',
],
])
?>
I had inline
layout in my form. This was a problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With