Last updated on 19 Feb 2018
Yii2 – Pagination in GridView
Copy below code before GridView
<div class="pull-right"> <?= Html::a(Yii::t('app', 'Create'), ['create'], ['class' => 'btn btn-success', 'id' => 'modal-btn-pop-up']) ?> </div> <div class="pull-left"> <?= \common\widgets\PageSize::widget([ 'id' => 'pageSize' ]); ?> </div>
Copy below code in GridView
'filterSelector' => 'select[name="pageSize"]', 'filterModel' => [], 'layout' => '<div class="table-responsive">{items}<div class="border-bottom-dashed"></div></div><div class="row"><div class="col-sm-5">{summary}</div><div class="col-sm-7"><div class="pull-right">{pager}</div></div></div>', 'tableOptions' => ['class' => 'table table-bordered table-hover'], 'pager' => [ // 'firstPageLabel' => Yii::t('app', 'First'), 'prevPageLabel' => Yii::t('app', 'Previous'), 'nextPageLabel' => Yii::t('app', 'Next'), // 'lastPageLabel' => Yii::t('app', 'Last'), 'maxButtonCount' => 10, ],