Alphapager demo

Showing 1-20 of 33 items.
#Last NameFirst NameBornDied
1GrunbergArnon1971/02/22
2GroeningMatt1954/02/15
3GrassGünther1927/10/162015/04/13
4GrapelliStéphane1908/01/261997/12/01
5GouldStephen Jay1941/09/102002/05/20
6GoscinnyRené1926/08/141977/11/05
7GordonDexter1923/02/231990/04/25
8GorbatsjovMichail1931/03/022022/08/30
9GombrowitzWitold1904/08/041969/07/24
10GogolNikolai1809/03/191852/03/04
11GoghTheo van1957/07/232004/11/02
12GoghVincent van1853/03/301890/07/29
13GoetheJohann Wolfgang von1749/08/281832/03/22
14GodardJean-Luc1930/12/032022/09/13
15GloverCrispin1964/04/20
16GilliganVince1967/02/10
17GilliamTerry1940/11/22
18GigerH.R.1940/02/052014/05/12
19GhandiMahatma1869/10/021948/01/30
20GetzStan1927/02/021991/06/06

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.