Alphapager advanced

Total 20 items.
#Last NameFirst NameBornDied
1AdjaniIsabelle1955/06/27
2AdlerCharlie1957/02/20
3AlbeeEdward1928/03/122016/09/16
4AldrinBuzz1930/01/20
5AliMuhammad1942/01/172016/06/03
6AllenWoody1935/12/01
7AndersonGerry1929/04/142012/12/26
8AndersonLaurie1947/06/05
9AndriessenLouis1939/06/062021/07/01
10AntonioniMichelangelo1912/09/292007/07/30
11ApollinaireGuillaume1880/08/261918/11/09
12AppelKarel1921/04/252006/05/03
13AragonLouis1897/10/031982/12/23
14ArakiNobuyoshi1940/05/25
15ArmstrongLouis1901/08/041971/07/06
16ArmstrongNeil1930/08/052012/08/25
17ArpHans1887/09/161966/06/07
18AsimowIsaac1920/01/021992/04/06
19AttenboroughDavid1926/05/08
20AznavourCharles1924/05/222018/10/01

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.