Default view of pagination is "1, 2, 3, ..., 10"
I need to transform it into "(first page), x, x, x, (current page), x, x, x, (last page)"
How can I do that?
<?= GridView::widget([
'pager' => [
'firstPageLabel' => 'First',
'lastPageLabel' => 'Last'
],
...
]) ?>
You need to specify $firstPageLabel and $lastPageLabel properties of LinkPager (they are false
by default meaning these links are not shown) . You can pass it to GridView
like that:
<?= GridView::widget([
...
'pager' => [
'firstPageLabel' => 'First',
'lastPageLabel' => 'Last',
],
...
]) ?>
For styling there are two additional properties: $firstPageCssClass and $lastPageCssClass.
Note that you can apply this to LinkPager
separately, without using GridView
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With