PHP code example of yiicod / yii2-pagesizepager

1. Go to this page and download the library: Download yiicod/yii2-pagesizepager 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/ */

    

yiicod / yii2-pagesizepager example snippets


'container' => [
    'singletons' => [
        \yiicod\pagesizepager\providers\ProviderInterface::class => [
            'class' => \yiicod\pagesizepager\providers\MongoProvider::class
        ]
    ],
],

echo \yii\grid\GridView::widget([
    'id' => 'uniqueGridId',
    'dataProvider' => $dataProvider,
    'filterSelector' => yiicod\perpager\widgets\PageSizePager::getFilterSelector($dataProvider),
    'pager' => [
        'class' => yiicod\perpager\widgets\PageSizePager::class,
        'gridIdentifier' => 'uniqueGridId',
    ]
]);

$dataProvider = new ActiveDataProvider([
    'query' => $query,
    'pagination' =>  [
        'pageSize' => \Yii::$container->get(\yiicod\pagesizepager\providers\ProviderInterface::class)->getPageSize('uniqueGridId'),
    ],
]);