Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yii-cms/yii2-select2
Select2 widget for Yii2 framework.
https://github.com/yii-cms/yii2-select2
Last synced: 26 days ago
JSON representation
Select2 widget for Yii2 framework.
- Host: GitHub
- URL: https://github.com/yii-cms/yii2-select2
- Owner: yii-cms
- Created: 2015-03-18T10:45:55.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2020-01-28T08:24:03.000Z (almost 5 years ago)
- Last Synced: 2024-05-02T13:55:35.898Z (8 months ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 5
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Select2 widget for Yii2 framework.
==================================https://github.com/select2/select2
```php
= $form->field($model, 'user_id')->widget(Select2::className(), [
'items' => ArrayHelper::map(User::find()->all(), 'id', function($model) {
return $model->username . " <{$model->email}>";
}),
'clientOptions' => [
'placeholder' => 'User',
'allowClear' => true,
],
'clientEvents' => [
'change'=>'function (e) {
console.log("Select2 change.");
}',
],
]) ?>
``````php
= Select2::widget([
'name' => 'InputName',
'items' => ArrayHelper::map(User::find()->all(), 'id', function($model) {
return $model->fio . " <{$model->email}>";
}),
'clientOptions' => [
'placeholder' => 'User',
'allowClear' => true,
]
]) ?>
```