CArrayDataProvider and CListView

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?

Maybe this is your problem:

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,

		   ));

	}




If we follow the tutorial as in the link : http://www.yiiframework.com/doc/guide/1.1/en/quickstart.first-app

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

" <li class="page selected"><a href="/yii/test/index.php?r=user/index&amp;ajax=yw0">1</a></li> "

But in my implmentation I have it like this : "<li class="page"><a href="/baseUrl/index.php?r=site/TestPage&amp;page=4">4</a></li>

You should have a js added at the bottom of the HTML output similar to:

jQuery(’#yw1’).yiiListView({‘ajaxUpdate’:[‘yw0’],‘ajaxVar’:‘ajax’,‘pagerClass’:‘pager’,‘loadingClass’:‘list-view-loading’,‘sorterClass’:‘sorter’});