Alphapager demo

Showing 1-20 of 28 items.
#Last NameFirst NameBornDied
1WyattRobert1945/01/28
2WrightRichard1943/07/282008/09/15
3WrightWill1960/01/20
4WoolfVirginia1882/01/251941/03/28
5WonderStevie1950/05/13
6WomackBobby1944/03/042014/06/27
7Wolinski1934/06/282015/01/07
8WittgensteinLudwig1889/04/261951/04/29
9WinehouseAmy1983/09/142011/07/23
10WilsonBrian1942/06/20
11WilsonE.O.1929/06/102021/12/26
12WilliamsJohn (Edward)1922/08/291994/03/03
13WilliamsRobin1951/07/212014/08/11
14WilliamsTennessee1914/03/261983/02/24
15WiesenthalSimon1908/12/312005/09/19
16WhiteTony Joe1943/07/23
17WestMae1893/08/171980/11/22
18WellsH.G.1866/09/211946/08/13
19WellesOrson1915/05/061985/10/10
20WeissPeter1916/11/081982/05/10

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.