Source

yii-chosen / readme.md

Chosen usage instructions

  1. Checkout source code to your project, for example to ext.chosen.
  2. Use it, as any input widget.

Example:

$this->widget('ext.chosen.Chosen',array(
    'name' => 'inputName', // input name
    'value' => '2', // selection
    'data' => array( // list of select options
        '1'=>'Option 1',
        '2'=>'Option 2',
        '3'=>'Option 3',
        '4'=>'Option 4',
    ),
));

Also you can use it like CHtml helper

Before this import ext.chosen.Chosen, you can add it to config/main.php or call Yii::import('ext.chosen.Chosen') before usage.

Chosen::dropDownList($name, $select, $data, $htmlOptions);
Chosen::activeDropDownList($model, $attribute, $data, $htmlOptions);
Chosen::multiSelect($name, $select, $data, $htmlOptions);
Chosen::activeMultiSelect($model, $attribute, $data, $htmlOptions);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.