Alphapager demo

Showing 1-20 of 40 items.
#Last NameFirst NameBornDied
1HyndeChrissie1951/09/07
2HuygensChristiaan1629/04/141695/07/08
3HuxleyAldous1894/07/261963/11/22
4HütterRalf1946/08/20
5HuppertIsabelle1953/03/16
6HuntHelen1963/06/15
7HouellebecqMichel1958/02/26
8HoudiniHarry1874/03/241926/10/31
9HopperDennis1936/05/172010/05/29
10HopperEdward1882/07/221967/05/15
11HopkinsAnthony1937/12/31
12HookerJohn Lee1917/08/222001/06/21
13HoltSimeon ten1923/01/242012/11/25
14HollandJools1958/01/24
15HofstadterDouglas1945/02/15
16HoffmanDustin1937/08/08
17HoffmanPhilip Seymour1967/07/232014/02/02
18HockneyDavid1937/07/09
19HitchensChristopher1949/04/132011/12/15
20HitchcockAlfred1899/08/131980/04/28

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.