Alphapager advanced

Total 28 items.
#Last NameFirst NameBornDied
1WagnerRichard1813/05/221883/02/13
2WaitsTom1949/12/07
3WalkenChristopher1943/03/31
4WalkerScott1943/01/092019/03/25
5WarholAndy1927/08/081987/02/22
6WatsonJames D.1928/04/06
7WattsCharlie1941/06/022021/08/24
8WayneJohn1907/05/261979/06/11
9WeissPeter1916/11/081982/05/10
10WellesOrson1915/05/061985/10/10
11WellsH.G.1866/09/211946/08/13
12WestMae1893/08/171980/11/22
13WhiteTony Joe1943/07/23
14WiesenthalSimon1908/12/312005/09/19
15WilliamsJohn (Edward)1922/08/291994/03/03
16WilliamsRobin1951/07/212014/08/11
17WilliamsTennessee1914/03/261983/02/24
18WilsonBrian1942/06/20
19WilsonE.O.1929/06/102021/12/26
20WinehouseAmy1983/09/142011/07/23
21WittgensteinLudwig1889/04/261951/04/29
22Wolinski1934/06/282015/01/07
23WomackBobby1944/03/042014/06/27
24WonderStevie1950/05/13
25WoolfVirginia1882/01/251941/03/28
26WrightRichard1943/07/282008/09/15
27WrightWill1960/01/20
28WyattRobert1945/01/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.