New yii user here, so thanks for helping. I’m trying to load some remote data into a clistview. It works fine, but as the remote data (flickr images) can take a while the whole page waits for it to load. I thought I would try placing the list in a different view, and then do a CHtml::ajax call to load the view.
Basically, like this:
... (get flickr images into an array to create a carraydataprovider)
$images = getFlickrImages($title);
$dataProvider=new CArrayDataProvider($images, array(
echo $this->renderPartial('_ajaxFlickr',array('dataProvider' => $dataProvider));
When I tried it the first page of images load as expected, but the pagination links aren’t styled and they point to ajaxflickr/tag?page=whatever. If I click the links they open ajaxFlickr as a new page and show the new images. I tried messing with the pagination routes but can’t find something that will make this work. So either I’m missing something, or I’m doing this the wrong way. Any ideas?
Now I see why you failed to see why I failed to see where the connection was…
My problem is not on the delayed loading of Flickr images, but on the fact that I cannot get my CListView (that I load through a renderPartial) to update through AJAX, after the second click. It seems that the pager buttons, instead of reloading inplace, they load a whole new page (without my layout).
From the forums and other post I read that it has to do with double loaded Clientscripts but I fail to see where the problem is exactly…
Unfortunately I have tried it your latest hint but it doesn’t seem to work in my case.
I ended up merging my two controller actions (the one drawing the view page and the one that was returning the ajax response) into one action (by checking if the request isAjaxRequest) and it seems to work now.