Alphapager demo
Showing 1-20 of 26 items.
# | Last Name | First Name | Born | Died |
---|---|---|---|---|
1 | Lynch | David | 1946/01/20 | — |
2 | Lowry | Malcolm | 1909/07/28 | 1957/06/27 |
3 | Lovelock | James | 1919/07/26 | 2022/07/26 |
4 | Lovelace | Ada | 1815/12/10 | 1852/11/27 |
5 | Lovelace | Linda | 1949/01/10 | 2002/04/22 |
6 | Lovecraft | H.P. | 1890/08/20 | 1937/03/15 |
7 | Loren | Sophia | 1934/09/20 | — |
8 | Lord | Jon | 1941/06/09 | 2012/07/16 |
9 | Lollobrigida | Gina | 1927/07/04 | 2023/01/16 |
10 | Little Richard | 1932/12/05 | 2020/05/09 | |
11 | Littell | Jonathan | 1967/10/10 | — |
12 | Lindemann | Till | 1963/01/04 | — |
13 | Ligeti | György | 1923/05/28 | 2006/06/12 |
14 | Lichtenstein | Roy | 1923/10/27 | 1997/09/29 |
15 | Leone | Sergio | 1929/01/03 | 1989/04/30 |
16 | Lennox | Annie | 1964/12/25 | — |
17 | Lennon | John | 1940/10/09 | 1980/12/08 |
18 | Lehrer | Tom | 1928/04/09 | — |
19 | Leeuwenhoek | Antoni van | 1632/10/24 | 1723/08/26 |
20 | Lee | Christopher | 1922/05/27 | 2015/06/07 |
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.