How to get current page number in infiniteScroll widget

Hello, Can any one help me on infinitescroll widget, for getting current page number. so when any user come back to this page I can "preload" those content which are loaded previously. When user click on load more content it will fire ajax request with, ohboysports.com/?page=2. so once user browse this page and come back again I have to preload those content with number page = 2.

Currently user has to click on load more content again when they browse this page again.

My code is as below,

<?php

$this->widget(‘zii.widgets.CListView’, array(

‘id’ => ‘SubmissionList’,

‘dataProvider’ => $thirdtierrecords,

‘itemView’ => ‘_view’,

‘emptyText’ => ‘Coming Soon’,

‘template’ => ‘{items} {pager}’,

‘pager’ => array(

‘class’ => ‘ext.infiniteScroll.IasPager’,

‘rowSelector’ => ‘.nodlt’,

‘listViewId’ => ‘SubmissionList’,

‘header’ => ‘’,

‘loaderText’ => ‘Loading…’,

‘options’ => array(

‘onRenderComplete’ => “js:function (items) { /init_addthis();/ createSwingEffect();}”,

‘history’ => false, ‘triggerPageTreshold’ => 1, ‘trigger’ => ‘Load more’),

),)

);

?>

Check enableHistory attribute:

http://www.yiiframework.com/doc/api/1.1/CListView#enableHistory-detail

Thanks for the quick reply.

But still I cannot preload previously loaded content when click browser Back button. I must have to click "Load More" button for loading content for infinitescroll when come back to home page.

After adding enableHistory my code is looking like this,

<?php

$this->widget(‘zii.widgets.CListView’, array(

‘id’ => ‘SubmissionList’,

‘dataProvider’ => $thirdtierrecords,

‘itemView’ => ‘_view’,

‘enableHistory’ => TRUE,

‘emptyText’ => ‘Coming Soon’,

‘template’ => ‘{items} {pager}’,

‘pager’ => array(

‘class’ => ‘ext.infiniteScroll.IasPager’,

‘rowSelector’ => ‘.nodlt’,

‘listViewId’ => ‘SubmissionList’,

‘header’ => ‘’,

‘loaderText’ => ‘Loading…’,

‘options’ => array(

‘onRenderComplete’ => “js:function (items) { /init_addthis();/ createSwingEffect();}”,

‘history’ => false, ‘triggerPageTreshold’ => 1, ‘trigger’ => ‘Load more’),

),

)

);

?>

Is there anything that I missing ?

In options of widget declaration i see




'options' => array(

'onRenderComplete' => "js:function (items) { /*init_addthis();*/ createSwingEffect();}",

'history' => false, 'triggerPageTreshold' => 1, 'trigger' => 'Load more'),

),



Have you tried to set ‘history’ to true?

Yes, I tried it, Now URL is giving me unexpected behavior while I make history = true.

Do I need to rewrite any rules regarding these ??

when I first click on "load more" button it fire ajax request like these, http://ohboysports.devdigdev.com/?page=2 , which is correct and same as previous it is behaving.

But when I scroll down with content load it will giving me these URL,

http://ohboysports.devdigdev.com/page/1?ajax=SubmissionList

http://ohboysports.devdigdev.com/page/2?ajax=SubmissionList

and give me error like, 404 not found.

Is there any solution for this ?

Can anyone help me on this ?