Real Time Search With Ajax In Gridview

I’m trying to add a real time search to my GridViews but I can’t find any working tutorial.

By real time search I mean: Image we have two users called Alex and Yii. If I want to search for one of them I have to type the whole name or part of it, but as soon as I type the first letter, I want it to show me only the names that start with an A.

Thanks.

Hi

You can use this following widget … to accomplish your requirment

$this->widget('zii.widgets.jui.CJuiAutoComplete', array(


    'model' =>$this->module->getUserModel(),


    'attribute'=>$this->module->username,


    'sourceUrl' => Yii::app()->urlManager->createUrl($parent."srbac/authitem/getUsers") ,


    // additional javascript options for the autocomplete plugin


    'options' => array(


        'minLength' => '2',


        'select'=>'js:function(event,ui){


          $.ajax({


            url: "'.$url.'",


              data : "id="+ui.item.id,


            success: function(html){


              $("#assignments").html(html);


            }


          });


    }',


    ),


    'htmlOptions' => array(


        'style' => 'height:20px;'


    ),


));