my code i used is
<?php $this->widget(‘zii.widgets.grid.CGridView’, array(
‘id’=>‘books-grid’,
‘dataProvider’=>$model->Projectwisereport(),
//‘filter’=>$model,
‘columns’=>array(
array(
'name' => 'Project',
'value' => 'Project::model()->findByPk($data->Project)->proj_name',
‘filter’=>CHtml::listData(Project::model()->findall(),‘proj_id’,‘proj_name’),
),
'isbn_no',
'source_type',
array(
'name' => 'complexity',
'value' => 'Complexity::model()->findByPk($data->complexity)->Complexity_Name',
'filter'=>CHtml::listData(Complexity::model()->findall(),'id','Complexity_Name'),
'footer'=>'Total Page',
),
array('class'=>'CButtonColumn',
'template'=>'{detail}',
'buttons'=>array(
'detail'=>array(
'label'=>'Show Details',
'url' =>'Yii::app()->createUrl("Process/detail", array("id"=>$data->book_id))',
'options'=>array('title'=>'Show details','class'=>'detailsLink'),
‘click’=>"$(’#your-grid-book_id’).on(‘click’,’.detailsLink’,function(){
var row=$(this).closest('tr');
var url=$(this).attr('href');
$.get(url,{},function(data){
row.after(data.row);
},'json');
})",
)
)
)
),
)); ?>
in controller
public function actiondetail($id)
{
$model=new Process('search');
$model->unsetAttributes(); // clear any default values
if(isset($_GET['Process']))
$model->attributes=$_GET['Process'];
$model->book_id=$id;
$this->render('detail',array(
'model'=>$model,
));
this will rendering anothed view correesponding grid filtered by id
my detail view is
<?php
$this->widget(‘zii.widgets.grid.CGridView’, array(
‘id’=>‘process-grid’,
'dataProvider'=>$model->search(),
'filter'=>$model,
'selectableRows'=>50,
'columns'=>array(
'book_id',
//'isbn_no',
array(
'name' => 'isbn_no',
'value' => 'Books::model()->findByPk($data->isbn_no)->isbn_no'
),
'Task',
'employee',
'totalpage',
'total_pg',
'totaltime',
),
));