I used yii 2.0. I displayed the list using data provider. For this i integrate the infinite scroll pagination.
Below is my code:
echo yii\widgets\ListView::widget([
'id' => 'my-listview-id',
'dataProvider' => $listDataProvider,
'itemView' =>'_item_view',
'pager' => [
'class' => nirvana\infinitescroll\InfiniteScrollPager::className(),
'widgetId' => 'my-listview-id',
'itemsCssClass' => 'test',
]
]);
Here the first 10 records displayed fine. Then the "Load More" button is displayed. But nothing is loaded. The infinite scroll is not working.
while viewing the source code the following script is displayed at the footer.
<script type="text/javascript">$('#my-listview-id .test').infinitescroll({"maxPage":5,"contentSelector":"#my-listview-id .test","itemSelector":"#my-listview-id .test >","navSelector":"#my-listview-id ul.pagination","nextSelector":"#my-listview-id ul.pagination li.next a:first","loading":{"img":"/fancytemple_blog/assets/a7b78b36/ajax-loader.gif"}}, ,);</script>
In console the script error shown is Uncaught SyntaxError: Unexpected token ,
Anybody will help to fix this. Thanks