Skip to content
Advertisement

Yii2 – how to set main config param pagination pageSizeLimit?

I want set main config param pageSizeLimit in class Pagination.

Example: (/backend/config/main.php)

'pagination' => [
        'class' => 'yiidataPagination',
        [
            'pageSizeLimit' => [1, 1000],
        ]
    ],

But it not working. So, how to set defaults for the entire site? Thank you very much!

Advertisement

Answer

You can use dependency injection container for this purpose.

Define default parameter’s value in bootstrapping section of config:

Yii::$container->set('yiidataPagination', [
    'pageSizeLimit' => [1, 1000],
]);

Read more on this in the guide https://github.com/yiisoft/yii2/blob/master/docs/guide/concept-configurations.md

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement