PHP code example of long399 / yii2-widget-advanced-linkpager
1. Go to this page and download the library: Download long399/yii2-widget-advanced-linkpager library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
long399 / yii2-widget-advanced-linkpager example snippets
echo GridView::widget([
...
'pager' => [
'class' => AdvancedLinkPager::class,
'options' => ['class' => 'pagination'],
'firstPageLabel' => 'начало',
'lastPageLabel' => 'конец',
'hideOnSinglePage' => false,
'template' => '{pageButtons}{pageList}{pageSize}{pageJump}',
'pageListLabel' => 'Страница',
'pageListCssClass' => 'btn btn-warning dropdown-toggle',
'pageSizeLabel' => 'Размер',
'pageSizeCssClass' => 'btn btn-primary dropdown-toggle',
'pageSizeItems' => [1, 10, 25, 50, 100],
],
...
]);
public function search($params)
{
...
$pageSize = isset($params['per-page']) ? intval($params['per-page']) : 10;
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => [
'pageSize' => $pageSize
],
]);
...
}