I am using the Cdataarrayprovider in the CListView. I am getting the data perfectly.
But my problem is , I am displaying the data in the popup and in the popup I have paginations also.
When I click on the pagination part of the popup, suppose say page "3", the page gets refreshed and the fater refresh page is going back to the base url from which I am bringing the popup.
Can I make the pagination work without page refresh?
If you render into a popup (I don’t which popup you mean) you normally should use renderPartial in your controller.
The pagination sends an ajax-request with the page as GET-param, but by default the gii-code renders the full page if it’s a (ajax) call from the pagination or not. So you have to check:
public function actionIndex()
{
$dataProvider=new YourArrayDataProvider(...);
if (Yii::app()->request->isAjaxRequest)
{
$this->renderPartial('index',array(
'dataProvider'=>$dataProvider,
//false, true <- maybe you have to set outputProcessing = true to render additional scripts too
));
Yii::app()->end();
}
else
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}
and if we try the same in our localcopy, if we goto the url "test/index.php?r=user/index" , we see the pagination implemented. In the pagination, the pages 1,2,3: if we see the console on clicking them , they carry a parameter "&ajax=…" this parameter itself is not there in my pagination link.
I am using CListView with CArrayDataProvider. From the tutorial demo, I get the pagination link as below