Problem With Clistview(Carraydataprovider) Pagination And Filtering

Hi All…

I had Problem with CListView(CArrayDataProvider) Pagination and Filtering as,

My Data is in array form ( We use Solr to search data ) as we create [size="2"]CListView using CArrayDataProvider.[/size]

[size="2"]First time on search with keyword it works as charm also with pagination (shows total 300 data) .[/size]

[size="2"]After that when I apply filter ( i.e Price Range… … ) using another ajaxPage it works fine (shows total 100 data) but… … …[/size]

[size="2"]On clicking pagination It just show previous list ( show total 300 data ) OR with some modification it gives NULL data.[/size]

[size="2"]…[/size]

[size="2"] We also pass extra filtering param from with pagination ajax call.[/size]

[size=“2”]but No Possitive result. (we haven’t get page number in controller).[/size]

Great thanks for any helpful reply.

Hi ,

have pass the processoutput on renderPartial page?

like


$this->renderPartail('index',$array('model'=>$model),false,true)

Yes we tried using another page to render updated result using with Ajax, also used with renderPartial.

Also here there is no model to provide data as we use Solr for search and passing data using [color="#1C2837"][size="2"]CArrayDataProvider.[/size][/color]

[size="2"][color="#1c2837"]…

[/color][/size]But no positive result.

Hi,

can u post the code?

There is much code to post… so can’t post here.

But I found this problem faced to some of user who tried with same scenario.

I thought the people who face this problem will understand promptly what problem is - and - Can give answer if they had resolve it…

Hi,

i think you can call the function on afterAjaxUpdate on admingridview


 'afterAjaxUpdate' => 'function(id, options){

				alert(id);

			}',




A very basic question, but didn’t you try to optimize the Solr query by peeking the pagination parameters?

Usually we have to supply all the raw data to the CArrayDataProvider without ‘offset’ and ‘limit’, otherwise CArrayDataProvider can’t sort or paginate the given raw data.

No we use dynamic param to get data from Solr, We haven’t use to obtain whole data as we had Millions of record from which we had to search result with keyword.

We use below code (Just for example, Don’t much go through it),




//Prepare fq query

				$stringjoin='';

				if(isset($facet_min) && isset($facet_max) && !isset($stringstore) && empty($stringstore)){

					$stringjoin.="priceTot:[".$facet_min ." TO " .$facet_max."]";

				}elseif(isset($facet_min) && isset($facet_max) && isset($stringstore) && !empty($stringstore)){

						$stringjoin.="priceTot:[".$facet_min ." TO " .$facet_max."] AND ".$stringstore; //OR replace with AND

				}

				//End Prepare fq query

				

				$additionalParameters = array(

									'facet' => 'true',

									'indent' => 'true',

									//'fq'=>"priceTot:[".$facet_min ." TO " .$facet_max."]",										

									'fq'=>$stringjoin,

                                    );

I mean, the raw data should be filtered according to the conditions, but you have to supply all the filtered data without offset and limit. When the filter gives you 500 items as a whole, then you should give them as the raw data.

You might want to supply just the necessary number of items for the page:

From 1 to 20 for the 1st page

From 21 to 40 for the 2nd page

But this optimization works only for the 1st page.

[/size]

Yes but we don’t get page number param in ajax post method.

The problem posted in first post is,

[size="2"][color="#000080"]First time on search with keyword it works as charm also with pagination (shows total 300 data) .[/color][/size]

[color="#000080"][size="2"]After that when I apply filter ( i.e Price Range… … ) using another ajaxPage it works fine (shows total 100 data) but… … …[/size][/color]

[size="2"][color="#000080"]On clicking pagination It just show previous list ( show total 300 data ) OR with some modification it gives NULL data.[/color][/size]

[size="2"] [/size]

[size=“2”][color="#000080"]First time using Solr with Yii :D[/color][/size]

I see.

Probably you have to store the filter parameters to the user’s state and restore them when you reply to the pagination calls.

CGridView has a filter, but CListView doesn’t.

[EDIT] I even don’t know what Solr is …