How To Get Data From Specified Row In Cgridview?

Please help me!

This is my code:

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

            'id'           => 'employee-grid',

            'dataProvider' => $em,

            'columns'      => $attribute,

            'filter'       => $em->model,

            'selectableRows'=> 1,


                var ids = $.fn.yiiGridView.getSelection(id);




use js found id, then ajax request to get row details update for form

Thanks @oxigen for reply!

I’m a newbie, and i don’t know how to get data from selected row to update the textField.

Can you help me?

Try follow code:

Yii::app()->clientScript->registerScript('UpdateForm', "

$('body').delegate('#employee-grid tbody > tr','click',function(){

    var id = $.fn.yiiGridView.getKey('employee-grid', $('#employee-grid tbody > tr').index(this));

    //request ajax update form

    $.getJSON('/path/to/get/details', {id:id}, function(data){

        //TODO: update form data




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

            'id'   		=> 'employee-grid',

            'dataProvider' => $em,

            'columns'      => $attribute,

            'filter'   	=> $em->model,