kartik-v / yii2-widget-select2

Enhanced Yii2 wrapper for the Select2 jQuery plugin (sub repo split from yii2-widgets).
http://demos.krajee.com/widget-details/select2
Other
322 stars 145 forks source link

Select 2 widget: maximium text on multiple selection to select all #367

Open abelwamana opened 1 month ago

abelwamana commented 1 month ago

Hi. I am using Tagging Support mult-select for your widget SELECT2 as "multiple => true", but when i have a lote of itens/text it can not be select all (Marcar todos), it stay disabled. See my codifcation:

field($eventModel, 'participantes')->widget(Select2::classname(), [ 'data' => ArrayHelper::map(Contacto::find()->all(), 'email', function ($model) { return $model->nome . ' - ' . $model->instituicao; }), 'options' => ['placeholder' => 'Selecione os participantes...', 'multiple' => true, 'id' => 'select-participantes'], 'pluginOptions' => [ 'allowClear' => true, ], ]); ?>

Captura de ecrã 2024-07-24 170629

abelwamana commented 1 month ago

I already found the solution, followed the error and changed the line: if (opts.length && opts[1]) to if (opts && opts.length && opts[1])