Alphapager advanced

Total 33 items.
#Last NameFirst NameBornDied
1GalileiGalileo1564/02/051642/01/08
2GambonMichael1940/10/192023/09/28
3GandolfiniJames1961/09/182013/06/19
4GanzBruno1941/03/222019/02/15
5GardnerMartin1914/10/212010/05/22
6GatesBill1955/10/28
7GaudiAntoni1852/06/251926/06/10
8GaussJohann Carl Friedrich1777/04/301855/02/23
9GeesinkAnton1934/04/062010/08/27
10GehryFrank1929/02/28
11GenetJean1910/12/191986/04/15
12GeorgeGötz1938/07/232016/06/19
13GershwinGeorge1898/09/261937/07/11
14GetzStan1927/02/021991/06/06
15GhandiMahatma1869/10/021948/01/30
16GigerH.R.1940/02/052014/05/12
17GilliamTerry1940/11/22
18GilliganVince1967/02/10
19GloverCrispin1964/04/20
20GodardJean-Luc1930/12/032022/09/13
21GoetheJohann Wolfgang von1749/08/281832/03/22
22GoghTheo van1957/07/232004/11/02
23GoghVincent van1853/03/301890/07/29
24GogolNikolai1809/03/191852/03/04
25GombrowitzWitold1904/08/041969/07/24
26GorbatsjovMichail1931/03/022022/08/30
27GordonDexter1923/02/231990/04/25
28GoscinnyRené1926/08/141977/11/05
29GouldStephen Jay1941/09/102002/05/20
30GrapelliStéphane1908/01/261997/12/01
31GrassGünther1927/10/162015/04/13
32GroeningMatt1954/02/15
33GrunbergArnon1971/02/22

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.