Reputation: 135
Hello everybody. I need to do a custom pagination for the GridView. In GridView I used:
'pager' => [
'prevPageLabel' => '<div style="border: none" class="glyphicon glyphicon-menu-left"></div>',
'nextPageLabel' => '<div style="border: none" class="glyphicon glyphicon-menu-right"></div>',
'maxButtonCount' => 0,
]
As a result, I get two arrows and then I can style them:
Question: How to put your own content between these arrows?
For example, I can get count of page: <?= $dataProvider->totalCount; ?>
and I want to put this total count of pages between the arrows of pagination. How can I do this?
Thanks!
Upvotes: 2
Views: 4964
Reputation: 18021
You can extend LinkPager class, override renderPageButtons() to generate whatever content you like and then use this extended class in GridView configuration:
'pager' => [
'class' => 'new\extended\LinkPager'
]
Upvotes: 3