LinkPager with infinite scroll support
php composer.phar require --prefer-dist "darkcs/yii2-infinite-scroll" "*"
true
;.list-view
;.item
;.pagination
;.pagination .next a:first
;40
;null
;$pjax = \yii\widgets\Pjax::begin();
echo \yii\widgets\ListView::widget([
'dataProvider' => $dataProvider,
'options' => [
'class' => '.list-view',
],
'itemView' => '_item',
'summary' => false,
'layout' => '{items}<div class="pagination-wrap">{pager}</div>',
'pager' => [
'class' => \darkcs\infinitescroll\InfiniteScrollPager::className(),
'paginationSelector' => '.pagination-wrap',
'pjaxContainer' => $pjax->id,
],
]);
\yii\widgets\Pjax::end();
// init
$('.list-view').infinitescroll();
// enable, paused by default
$('.list-view').infinitescroll('start');
// disable
$('.list-view').infinitescroll('stop');
$('.list-view').on('infinitescroll:afterRetrieve', function(){
console.log('infinitescroll:afterRetrieve');
});
$('.list-view').on('infinitescroll:afterStart', function(){
console.log('infinitescroll:afterStart');
});
$('.list-view').on('infinitescroll:afterStop', function(){
console.log('infinitescroll:afterStop');
});
No stable releases.
Comments