This pagination Using CActiveDataProvider , zii.widgets.grid.CGridView and ClinkPager.
Howto
Controller :
// create ActiveDataRecord Object, with option pagination
$dataProvider = new CActiveDataProvider('MODEL',array('criteria'=>array('order' => 'id'),
'pagination'=>array('pageSize'=>2)
));
// Passing that object to view, we don't need using method getData()
$this->render('your_view', array('dataProvider' => $dataProvider,));
View :
//use widget CGridView and class CLinkPager
$this->widget('zii.widgets.grid.CGridView', array(
'dataProvider'=>$dataProvider,
'pager'=>array(
'class'=>'CLinkPager',
'header'=>'',
'prevPageLabel'=>'<',
'nextPageLabel'=>'>',
'firstPageLabel'=>'First',
'lastPageLabel'=>'Last',),
'enablePagination' => true,
));
*look at the mark , that's the basic pagination with widget CGridView and CLinkPager.
Post a Comment
Harap gunakan bahasa yang baik dan sopan, terima kasih