Alphapager demo

Showing 1-20 of 26 items.
#Last NameFirst NameBornDied
1LynchDavid1946/01/20
2LowryMalcolm1909/07/281957/06/27
3LovelockJames1919/07/262022/07/26
4LovelaceAda1815/12/101852/11/27
5LovelaceLinda1949/01/102002/04/22
6LovecraftH.P.1890/08/201937/03/15
7LorenSophia1934/09/20
8LordJon1941/06/092012/07/16
9LollobrigidaGina1927/07/042023/01/16
10Little Richard1932/12/052020/05/09
11LittellJonathan1967/10/10
12LindemannTill1963/01/04
13LigetiGyörgy1923/05/282006/06/12
14LichtensteinRoy1923/10/271997/09/29
15LeoneSergio1929/01/031989/04/30
16LennoxAnnie1964/12/25
17LennonJohn1940/10/091980/12/08
18LehrerTom1928/04/09
19LeeuwenhoekAntoni van1632/10/241723/08/26
20LeeChristopher1922/05/272015/06/07

Yii2 Alphapager lets you do alphabetic paging in the Yii framework 2.0. On this page it is shown in it's default operation, 'out of the box'.

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',
]);
?>

<?= AlphaPager::widget([
    'dataProvider' => $dataProvider,
]) ?>

<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],

        'last_name:ntext',
        'first_name:ntext',
        'born:date',
        'died:date',
    ],
]); ?>

A slightly more advanced example is here.