PHP code example of kop / yii2-scroll-pager

1. Go to this page and download the library: Download kop/yii2-scroll-pager library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

kop / yii2-scroll-pager example snippets


echo ListView::widget([
     'dataProvider' => $dataProvider,
     'itemOptions' => ['class' => 'item'],
     'itemView' => '_item_view',
     'pager' => ['class' => \kop\y2sp\ScrollPager::className()]
]);

echo ListView::widget([
     'options' => ['class' => 'list-view'],
     'dataProvider' => $listDataProvider,
     'itemOptions' => ['tag' => false],
     'itemView' => '_list_item',
     'summary' => '',
     'layout' => '{items}{pager}',
     'pager' => [
          'class' => \kop\y2sp\ScrollPager::className(),
          'item' => 'article',
          'next' => '.next a',
          'paginationSelector' => '.list-view .pagination',
          'triggerText' => Yii::t('app', 'Show more'),
          'triggerTemplate' => '<span class="reveal-btn">{text}</span>',
          'noneLeftText' => '',
          'noneLeftTemplate' => '',
          'spinnerSrc' => '',
          'spinnerTemplate' => '',
          'linkPager'     => [
               'prevPageCssClass' => 'btn-link prev',
               'nextPageCssClass' => 'btn-link next',
               'prevPageLabel' => '<span class="prev-page">prev</span>',
               'nextPageLabel' => '<span class="next-page">next</span>',
          ],
          'linkPagerOptions'     => [
               'class' => 'pagination',
          ],
          'linkPagerWrapperTemplate' => '<div class="button-news-more"><div class="wrapper"><div class="paging">{pager}</div></div></div>',
          'eventOnPageChange' => 'function() {{{ias}}.hidePagination();}',
          'eventOnReady' => 'function() {{{ias}}.restorePagination();}',
     ],
]);

echo GridView::widget([
     'dataProvider' => $dataProvider,
     'pager' => [
        'class' => \kop\y2sp\ScrollPager::className(),
        'container' => '.grid-view tbody',
        'item' => 'tr',
        'paginationSelector' => '.grid-view .pagination',
        'triggerTemplate' => '<tr class="ias-trigger"><td colspan="100%" style="text-align: center"><a style="cursor: pointer">{text}</a></td></tr>',
     ],
]);
 php composer.phar