Alphapager advanced

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

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.