Alphapager advanced

Total 28 items.
#Last NameFirst NameBornDied
1RussellBertrand1872/05/181970/02/02
2RussellJane1921/06/212011/02/28
3RushdieSalman1947/06/19
4RubinsteinArthur1887/01/281982/12/20
5RovelliCarlo1956/05/03
6RousselRaymond1877/01/201933/07/14
7RottenJohnny1956/01/31
8RotaNino1911/12/031979/04/10
9RosselliniIsabella1952/06/18
10RoegNicholas1928/08/152018/11/23
11RodinAuguste1840/11/121917/11/17
12RobinsonEdward G.1893/12/121973/01/26
13RoachMax1924/01/102007/08/16
14RijnRembrandt van1606/07/151669/10/04
15RiggDiana1938/07/202020/09/10
16RietveldGerrit1888/06/241964/06/26
17RiefenstahlLeni1902/08/222003/09/09
18RichardsonIan1934/04/072007/02/09
19RichardsKeith1943/12/18
20RichBuddy1917/09/301987/04/02
21ReznorTrent1967/05/17
22ReinhardtDjango1910/01/231953/05/16
23Reich-RanickiMarcel1920/06/022013/09/18
24ReeveChristopher1952/09/252004/10/10
25ReedLou1942/03/022013/10/27
26RedgraveVanessa1937/01/30
27RayMan1898/08/271976/11/18
28RandiJames1928/08/072020/10/20

Yii2 Alphapager lets you do alphabetic paging in the Yii framework 2.0. On this page it is shown with some special settings.

The relevant code involved is something like this:

<?php

use sjaakp\alphapager\ActiveDataProvider;
use sjaakp\alphapager\AlphaPager;

$query = Person::find()->orderBy('last_name, first_name');

$dataProvider = new ActiveDataProvider([
    'query' => $query,
    'alphaAttribute' => 'last_name',
    'alphaDigits' => 'compact',                // one button for digits '0' - '9'
    'alphaPages' => [
        'P' => [
               'label' => 'pq',                // label button 'P' with 'pq'
               'pattern' => [ '[PpQq]' ],      // regular expression: include words starting with 'Q' under 'P'
           ],
        'Q' => false,                          // suppress page 'Q'
        'Z' => [
               'label' => 'x-z',               // label button 'Z' with 'x-z'
               'pattern' => [ '[X-Zx-z]' ],    // regular expression: include words starting with 'X' or 'Y' under 'Z'
           ],
        'X' => false,                          // suppress page 'X'
        'Y' => false,                          // suppress page 'Y'
    ],
    'pagination' => false                      // switch off normal pagination
]);
?>

<?= AlphaPager::widget([
    'dataProvider' => $dataProvider,
    'preButtons' => [],                       // no 'all' button
    'lowerCase' => true                       // buttons in lower case
]) ?>

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],

        'last_name:ntext',
        'first_name:ntext',
        'born:date',
        'died:date',
    ],
]); ?>

A basic example is here.