controller:
public function actionIndex()
{
// renders the view file 'protected/views/site/index.php'
// using the default layout 'protected/views/layouts/main.php'
$rawData= Student::model()->findAll();
// or using: $rawData=User::model()->findAll();
$dataProvider=new CArrayDataProvider($rawData, array(
'id'=>'user',
'sort'=>array(
'attributes'=>array(
'id', 'name', 'c_id', 'l_id', 'email'
),
),
'pagination'=>array(
'pageSize'=>10, //records display
),
));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
Index.php:
<?php
/* @var $this SiteController */
$this->pageTitle=Yii::app()->name;
$this->widget('bootstrap.widgets.TbGridView',array(
'id'=>'user-info-grid',
'dataProvider'=>$dataProvider,
'type'=>'striped bordered condensed',
'template'=>'{summary}{pager}{items}{pager}',
'columns'=>array(
'ID',
'Name',
'Course',
'Book',
'Email',
),
));
?>
I have a student model in which student table is there.
But it is not showing data in grid why.
i think i am doing something wrong.