- CGridView is one of Zii Components
- There is other than CGridView, CDetailView, CListView. Look here.
- CGridView use DataProvider which define in controller
- CGridView display data in tables.
- Supports paginating, sorting, searching.
- Also support view, update, delete method
Define our data provider in controller like this
[php]
/**
* Lists all models.
*/
public function actionIndex()
{
$dataProvider=new CActiveDataProvider(‘User’,
array(
‘pagination’=>array(
‘pageSize’=>10,
),
‘sort’=>array(
‘defaultOrder’=> array(‘id’=>false),
)
));
$this->render(‘index’,array(
‘dataProvider’=>$dataProvider,
));
}
[/php]