I want to use the ajaxUrl property to customize the URL for update CListView’s pages, but this property not work, the requests are made to the current URL, I try to debug it with Firebug and seems CLinkPager widget don’t know which is the ajax URL to use when user click on a page number: the options passed to $.fn.yiiListView.update include the current URL, not the ajaxUrl.
EDIT: My code looks like.
The view:
$this->widget('zii.widgets.CListView',array(
'dataProvider'=>$lastPosts,
'itemView'=>'_post',
'ajaxUrl'=>'site/lastPosts'
));
//... Another widgets with other DataProviders
The site controller:
public function actionLastPosts(){
$lastPosts = Post::findLastPosts();
$this->widget('zii.widgets.CListView',array(
'dataProvider'=>$lastPosts,
'itemView'=>'_post',
'ajaxUrl'=>'site/lastPosts'
));
}
But setting the route to DataProvider’s pagination before calling the widget, works… checking the CListView and related classes code, I notice that Yii use the pagination attribute of the DataProvider and the createPageUrl method of that pagination to generate the URL, but never assign a route to that pagination, then the route is empty => current URL.
Do note, however, if your application is already calling certain parameters – say for a page ID – you’ll need to specify it within the params variable again:
If clistview is displayed using ajax in a separate div tag and clicked on the next button of pager the view gets displayed improperly with layout being changed what could be the problem