/yii2-chosen-select

Select Widget based on Chosen jQuery plugin

Primary LanguagePHPMIT LicenseMIT

Chosen Select Widget for Yii 2

Chosen Select Widget based on Chosen jQuery plugin chosen

Latest Stable Version Total Downloads License Build Status

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist yii2mod/yii2-chosen-select "*"

or add

"yii2mod/yii2-chosen-select": "*"

to the require section of your composer.json.

Usage

  1. Usage with ActiveForm and model
   echo $form->field($model, 'subject')->widget(\yii2mod\chosen\ChosenSelect::className(),[
                    'items' => [
                        'first' => 'First',
                        'second' => 'Second'
                    ],
                ]); 
  1. Usage without a model
   echo \yii2mod\chosen\ChosenSelect::widget([
        'name'  => 'select',
        'items' => BooleanEnum::listData(),
        'options' => [
            'width' => '95%'
        ]
    ]);

Select Options

You can find them on the options page