alex-bond / yii2-select2-widget
The select2 widget for Yii framework.
Installs: 5 069
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 8
Open Issues: 0
Type:yii2-extension
Requires
- php: >=7.0.0
- bower-asset/select2: 4.*
- bower-asset/select2-bootstrap-theme: *
- yiisoft/yii2: *
Requires (Dev)
- scrutinizer/ocular: ~1.1
This package is auto-updated.
Last update: 2024-10-24 19:55:54 UTC
README
Select2 widget is a wrapper of Select2 for Yii 2 framework.
Install
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist alex-bond/yii2-select2-widget "*"
or add
"alex-bond/yii2-select2-widget": "*"
to the require section of your composer.json
file.
Usage
Once the extension is installed, simply use it in your code by:
use alexBond\select2\Widget; echo $form->field($model, 'field')->widget(Widget::className(), [ 'options' => [ 'multiple' => true, 'placeholder' => 'Choose item' ], 'settings' => [ 'width' => '100%', ], 'items' => [ 'item1', 'item2', ... ], 'events' => [ 'select2-open' => 'function (e) { log("select2:open", e); }', 'select2-close' => new JsExpression('function (e) { log("select2:close", e); }') ... ] ]);
Testing
$ phpunit
Further Information
Please, check the Select2 documentation for further information about its configuration options.
Contributing
Please see CONTRIBUTING for details.
Credits
License
The BSD License (BSD). Please see License File for more information.