EChosen

Views

Вывести listbox

<?php echo $form->dropDownList($model,'category',$model->GetCategoryList(), array( 'empty'=>'- select -', 'options' => array(Yii::app()->request->getQuery('id')=>array('selected'=>true)), 'class' => 'category', ) );
Преобразовать listbox в Chosen http://harvesthq.github.com/chosen/ привязка осуществляется по классу target = имя селектора
$this->widget( 'application.views.widgets.EChosen.EChosen', array( 'target' => '.category', 'useJQuery' => true, 'debug' => true, //'options' => array(), )); ?>

Model

public function GetCategoryList(){ $Categories = Category::model()->findAll(); $output = array(); foreach($Categories as $Category){ $Types = CHtml::listData( Types::model()->findAll('category = :category', array(':category' => $Category->id)), 'id', 'name' ); $output[$Category->name] = $Types; } return $output; }