This extension uses Infinite Ajax Scroll, a jQuery plugin
March 5, 2013 Added loaderText public property. Thanks to maxxdev
February 8, 2013 Now you can manually trigger loading page. Thanks to Junior - df9. Example code also has been updated.
Yii
Put this extension to your extensions directory
Example code
$this->widget('zii.widgets.CListView', array( 'id' => 'VideoList', 'dataProvider' => $dataProvider, 'itemView' => '_view', 'template' => '{items} {pager}', 'pager' => array( 'class' => 'ext.infiniteScroll.IasPager', 'rowSelector'=>'.row', 'listViewId' => 'VideoList', 'header' => '', 'loaderText'=>'Loading...', 'options' => array('history' => false, 'triggerPageTreshold' => 2, 'trigger'=>'Load more'), ) ) );
Total 19 comments
I am floating the items so the items div doesnt seem to have any height (when higlighted in firebug doesnt shade al the CListView). Could this affect somehow?
Hey guys this isnt working for me; CActiveDataProvider creation:
View using CListView to display the dataProvider:
Try set history=>false as in example code to disable history support
Hi, i noticed that the url has changed to 123.com/page/2 when you scroll down. This is a little bit inconvenience because user can't click go back in their browse to go back to previous page anymore, they are going to /page/1 instead. Also, if you refresh the page, the url stays as /page/2 which automatically scrolls you down.
Is there a way to prevent this from happening? (so the url remains the same all the time when you scroll)
Thank you.
Hi,
Thanks for the fast replay... It's indeed the first thing I've tried ... It seems it is working now but the pagination buttons are still displayed after the update ...
Regards
Hi, have you tried calling "jQuery.ias(..." code again after the "..fn.update..." ?
regards
Hi,
This is an awesome plugin, it helped me a lot! I have a slight problem which I was trying to correct with no success ...
When the page loads for the first time, the infinite scrolling works ok. But if I am making an $.fn.yiiListView.update() on the list that has the infinite scrolling, it stops working and it displays the pagination buttons instead.
Does anyone knows how to solve this issue ? It took me hours to solve this but I didn't find a solution.
Thanks so much !
After hours debugging javascript, it was not the problem...I just removed some URL rules in the main config file.
As I use slugs to show beautiful URLs, it seems that the following rule:
'webtv/<slug:[a-zA-Z0-9-]+>'=>'webtv/view',
Was messing things out.
My infinite-scroll is in the index action of WebtvController and when it calls for the 2nd page, the "view" action is called, which has a redirect when it can't find the model by slug, so a second call is made to the webtv index, giving the first page again...
Thanks anyway guys
Regards
Hi, guys, I'm probably missing sth but infinite always get the first page of the dataprovider.
I saw in firebug that it makes 2 calls: 1 - call the url to get the second page - OK 2 - call the url of the page without parameters (maybe here gets the first page again) - wrong?
The content is always appended by the first page
Any clues on how to solve this?
Thank you very much!
Thanks for extension. Pls add ability to change loader text
Hello!
Please, update the extension so ppl can enjoy the new feature "Manual Trigger"
Thanks in advance
Regards!
Hi, Thanks for this great contribution.
I am implementing the tabs in my page so I want multiple infinite scrolls for every tabs...
Is there a way to do so? Right now only one is allowed per page.
If you have array of models then you could create CArrayDataProvider and still use CListView with this extension
This widget works great. However it relies on the pagination of CListView, I need to pass models of object instead of array of object. Do you have any idea how to improve it?
Thanks for your great contribution.
Beautiful code, thank you for taking the time to make this!
Thank you so much!
My testdrive is fatal on
If you need to run javascript after new items been loaded (in case some jquery breaks...) then add 'options'=>array('onRenderComplete'=>'js:function () { ///js code here }'),Leave a comment
Please login to leave your comment.