Cgridview Filter Whit Cautocomplete

I want to filter an GridView by using an autocomplete field since the table of values has over 4000 entries and a simple dropdown wouldn’t help. what i’ve tried so far lots of ways. closest i got was this way :

View file:

    $this->widget('zii.widgets.grid.CGridView', array(


    	'afterAjaxUpdate' => 'reinstallDatePicker',







            'filter'=>CHtml::listData(Angajati::model()->findAll(array('order'=>'nume')), 'id_angajat', 'nume'),

    		'value' => '$data->idAngajat->nume',






                         //name of the html field that will be generated


                         //replace controller/action with real ids


             'max'=>10, //specifies the max number of items to display

                         //specifies the number of chars that must be entered 

                         //before autocomplete initiates a lookup


             'delay'=>500, //number of milliseconds before lookup occurs

             'matchCase'=>false, //match case when performing a lookup?


                         //any additional html attributes that go inside of 

                         //the input field can be defined here

             'htmlOptions'=>array('size'=>'20', 'placeholder'=>'cauta produs'), 



             )), true),


Controller code:

    public function actionProdLookup()



           if(Yii::app()->request->isAjaxRequest && isset($_GET['q']))


                /* q is the default GET variable name that is used by

                / the autocomplete widget to pass in user input


              $denumire = $_GET['q'];


                        // this was set with the "max" attribute of the CAutoComplete widget

              $limit = min($_GET['limit'], 50); 

              $criteria = new CDbCriteria;

              $criteria->condition = "denumire LIKE :sterm";

              $criteria->params = array(":sterm"=>"%$denumire%");

              $criteria->limit = $limit;

              $prodArray = Produse::model()->findAll($criteria);

              $returnVal = '';

              foreach($prodArray as $prod)


                 $returnVal .= $prod->getAttribute('denumire').'|'




              echo $returnVal;



This works perfect in any form. in my gridview it appears above the table and it dosen’t work. really need help since i’ve tried to fix it for 2 days and can’t seem to figure it out.