Alphapager advanced

Total 26 items.
#Last NameFirst NameBornDied
1LaanEberhard van der1955/06/282017/10/05
2LamarrHedy1914/11/092000/01/19
3LangFritz1890/12/051976/08/02
4LartigueJacques-Henri1894/06/131986/09/12
5LaurelStan1890/06/161965/02/23
6LeeChristopher1922/05/272015/06/07
7LeePeggy1920/05/262002/01/21
8LeeuwenhoekAntoni van1632/10/241723/08/26
9LehrerTom1928/04/09
10LennonJohn1940/10/091980/12/08
11LennoxAnnie1964/12/25
12LeoneSergio1929/01/031989/04/30
13LichtensteinRoy1923/10/271997/09/29
14LigetiGyörgy1923/05/282006/06/12
15LindemannTill1963/01/04
16LittellJonathan1967/10/10
17Little Richard1932/12/052020/05/09
18LollobrigidaGina1927/07/042023/01/16
19LordJon1941/06/092012/07/16
20LorenSophia1934/09/20
21LovecraftH.P.1890/08/201937/03/15
22LovelaceAda1815/12/101852/11/27
23LovelaceLinda1949/01/102002/04/22
24LovelockJames1919/07/262022/07/26
25LowryMalcolm1909/07/281957/06/27
26LynchDavid1946/01/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.