consultnn / yii2-select2
Yii2 widget wrapper for jquery select2 plugin v4.*
v1.0.1
2015-08-24 14:15 UTC
Requires
- php: >=5.4.0
- bower-asset/select2: 4.*
- yiisoft/yii2: 2.0.*
This package is not auto-updated.
Last update: 2024-11-09 18:38:10 UTC
README
Select2 widget is a wrapper of Select2 for Yii 2 framework.
Install
php composer.phar require --prefer-dist consultnn/yii2-select2 "*"
or add to composer.json
"consultnn/yii2-select2": "*"
Usage
echo $form->field($model, 'attribute')->widget(
\consultnn\select2\Select2::className(),
[
'options' => [
'multiple' => true
],
'items' => $items, // @see Html::dropDownList() $items argument
'pluginOptions' => [
'ajax' => [
'url' => Url::toRoute(['controller/autoComplete']), // return Json::encode(['results' => [['id' => 1, 'text' => 'text1'], ...]]);
'dataType' => 'json'
]
]
]
);