====== EChosen ======

===== Views =====


Вывести listbox
<code php>
    <?php
      echo $form->dropDownList($model,'category',$model->GetCategoryList(), 
        array(
          'empty'=>'- select -', 
          'options' => array(Yii::app()->request->getQuery('id')=>array('selected'=>true)),
          'class' => 'category',
        )
      );
</code>

<note tip>Преобразовать listbox в Chosen http://harvesthq.github.com/chosen/ 
привязка осуществляется по классу target = имя селектора</note>
<code php>
      $this->widget( 'application.views.widgets.EChosen.EChosen', array(
        'target' => '.category',
        'useJQuery' => true,
        'debug' => true,
        //'options' => array(),
      ));    
    ?>
</code>

===== Model =====

<code php>
    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;
    } 
</code>
