Alphapager demo

Showing 1-20 of 25 items.
#Last NameFirst NameBornDied
1KafkaFranz1883/07/031924/06/03
2KakehashiIkutaro1930/02/072017/04/01
3Kamerlingh OnnesHeike1853/09/211926/02/21
4KandinskyWassily1866/12/161944/12/13
5KantImmanuel1724/04/221804/02/12
6KarinaAnna1940/09/222019/12/14
7KarshYousuf1908/12/032002/07/13
8KeatonBuster1895/10/041966/02/01
9KeitelHarvey1939/05/13
10KennedyJohn F.1917/05/291963/11/22
11KeplerJohannes1571/12/171630/11/15
12KerouacJack1922/03/121969/10/21
13KieferAnselm1945/03/08
14KilmisterLemmy1945/12/242015/12/28
15KingBen E.1938/09/282015/04/30
16KingB.B.1925/09/162015/05/14
17KinskiKlaus1926/10/181991/11/23
18KleePaul1879/12/181942/06/29
19KnuthDonald1938/01/10
20KoestlerArthur1905/09/051983/03/03

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.