Hello i want a gird view but conditional .
for example i have a studentcourserelation table in which i want data only related to particular id not whole table.
my code is below
public function actionIndex()
{
$login_id=yii::app()->session['login_id'];
$dataProvider=new CActiveDataProvider('StudentCourseRelation',array(
'criteria'=>array('condition'=> $this->id==$login_id)
));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
<h1>Courses Selected by you</h1>
<?php
$this->widget('bootstrap.widgets.TbGridView',array(
'id'=>'user-info-grid',
'dataProvider'=>$dataProvider,
'type'=>'striped bordered ',
'template'=>'{summary}{pager}{items}{pager}',
'columns'=>array(
'user_id',
'course.course_name',
'course.course_details',
'created_date',
),
));
?>
what should i do.above code display whole data of table but i want only those data whom user_id is 2 .