Alphapager advanced

Total 30 items.
#Last NameFirst NameBornDied
1DahlRoald1916/09/131990/11/23
2DaliSalvador1904/05/111989/01/23
3DaltreyRoger1944/03/01
4DarwinCharles Robert1809/02/121882/04/19
5DaviesRay1944/06/21
6DavisMiles1926/05/261991/09/28
7DawkinsRichard1941/03/26
8DeakinsRoger1949/05/24
9DeneuveCatherine1943/10/22
10DepardieuGérard1948/12/27
11DeVilleWilly1950/08/252009/08/06
12DickPhilip K.1928/12/161982/03/02
13DietrichMarlene1901/12/271992/05/06
14DijkstraEdsger1930/05/112002/08/06
15DöblinAlfred1878/08/101957/06/28
16DolphyEric1928/07/201964/06/29
17DominoFats1928/02/262017/10/25
18Donovan1946/05/10
19DoohanJames1920/03/032005/07/20
20DoornJohnny van1944/11/121991/01/26
21Dos PassosJohn Roderigo1896/01/141970/09/28
22DubuffetJean1901/07/311985/05/12
23DuchampMarcel1887/07/281968/10/01
24Duffy1984/06/23
25DukeGeorge1946/01/122013/08/05
26DunTan1957/08/18
27DurasMarguerite1914/04/041996/03/03
28DuryIan1942/02/122000/03/27
29DylanBob1941/05/24
30DysonFreeman1923/12/152020/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.