2017 © Pedro Peláez
 

yii2-extension yii2-reversed-pagination

Yii2 reversed pagination

image

loveorigami/yii2-reversed-pagination

Yii2 reversed pagination

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 2 Versions
  • 7 % Grown

The README.md

Yii2-reversed-pagination

Installation

Composer

The preferred way to install this extension is through Composer., (*1)

Either run php composer.phar require loveorigami/yii2-reversed-pagination "~2.0", (*2)

or add "loveorigami/yii2-reversed-pagination": "~2.0" to the require section of your composer.json, (*3)

Using

Use for reversed pagination for Yii2., (*4)

In controller, (*5)

    public function actionIndex()
    {
        $query = Article::find()->all();
        $countQuery = clone $query;
        $pages = new \loveorigami\pagination\ReversePagination(
            [
                'totalCount' => $countQuery->count(),
                'pageSize' => 10, // or in config Yii::$app->params['pageSize']
            ]
        );
        $pages->pageSizeParam = false;
        $models = $query->offset($pages->offset)
            ->limit($pages->limit)
            ->all();

        return $this->render('index',
            [
                'models'  => $models,
                'pages' => $pages,
            ]
        );
    }

In view, (*6)

    foreach($models as $model): 
      // display a model...
    endforeach; 

    echo \loveorigami\pagination\ReverseLinkPager::widget([
        'pagination' => $pages,
        'registerLinkTags' => true
    ]);

The Versions

16/11 2014

dev-master

9999999-dev https://github.com/loveorigami/yii2-reversed-pagination

Yii2 reversed pagination

  Sources   Download

MIT

The Requires

 

yii2 yii behavior slug

16/11 2014

2.1

2.1.0.0 https://github.com/loveorigami/yii2-reversed-pagination

Yii2 reversed pagination

  Sources   Download

MIT

The Requires

 

yii2 yii behavior slug