If I try to drop a pagination widget at the top of some data taken from a CActiveDataProvider no pagination is showng, hoowever it only displays after I’ve gone through all the data, allowing me to put a CLinkPager at the footer. It’s Not that helpful really since I need pagination both top and bottom of data output.
So, this doen’t work as I would have expected (paging at the top and bottom of the data output)
$this->widget('CLinkPager',array('pages'=>$dataProvider->pagination));
foreach($dataProvider->getData() as $q=>$data)
$this->widget("ResultView", array("user"=>$data, "last"=>$q%4?false:true));
$this->widget('CLinkPager',array('pages'=>$dataProvider->pagination));
A workaround is to iterate the CActiveDataProvider without doing anything with it, then dropping in a CLinkPager, reiterate the CActiveDataProvider - only this time using the data properly - and then dropping in the next pager.
Therefore the following does what I neeed, though it’s rather ugly to have an otherwise redundant loop.
foreach($dataProvider->getData() as $data);
$this->widget('CLinkPager',array('pages'=>$dataProvider->pagination));
foreach($dataProvider->getData() as $q=>$data)
$this->widget("ResultView", array("user"=>$data, "last"=>$q%4?false:true));
$this->widget('CLinkPager',array('pages'=>$dataProvider->pagination));
Unsure if this was intentional or not… either way it is rather frustrating.
Onwards and upwards!