Alphapager demo

Showing 1-20 of 26 items.
#Last NameFirst NameBornDied
1PacinoAl1940/04/25
2PageBettie1923/04/222008/12/11
3PaikNam June1932/07/202006/01/29
4PalahniukChuck1962/02/21
5PalinMichael1943/05/05
6PalmaBrian De1940/09/11
7PalmerRobert1949/01/192003/09/26
8ParkerTrey1969/10/19
9PasoliniPier Paolo1922/03/051973/04/08
10PaulAaron1979/08/27
11PaulLes1915/06/092009/08/13
12PaxmanJeremy1950/05/11
13PetersonOscar1925/08/152007/12/23
14PettyTom1950/10/202017/10/02
15PicassoPablo1881/10/251973/04/08
16PiccoliMichel1925/12/27
17PinterHarold1930/10/10
18PlanckMax1858/04/231947/10/03
19PoeEdgar Allan1809/01/191849/10/07
20PolanskiRoman1933/08/18

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.