Pagination in Yii framework doesn't work correctly

127 views Asked by At

Could you possibly help me, please, I'm implementing pagination on my news page as it shown at this page.

On the very first page it is working fine. But when I click on a page link to get page 2 or page 3, I get a blank result. No data, no pager. What should I do to fix it?

2

There are 2 answers

1
Mukund Sojitra On

You basically just specify a page size on your data provider / active record

 $model = new CArrayDataProvider( $dataRow, 
         array('pagination'=> array('pageSize'=>5) ));
1
GauravGD On

I have faced the same problem awhile ago i resolved by changing the method name except index because by googling i found that lots of pagination doesn't work with index method i am not sure about this just sharing my experience.