Alphapager demo
Showing 1-20 of 25 items.
# | Last Name | First Name | Born | Died |
---|---|---|---|---|
1 | Kubrick | Stanley | 1928/07/26 | 1999/03/07 |
2 | Kravitz | Lennie | 1964/05/26 | — |
3 | Koons | Jeff | 1955/01/21 | — |
4 | Kooning | Willem de | 1904/04/24 | 1997/03/19 |
5 | Koolhaas | Rem | 1944/11/17 | — |
6 | Koestler | Arthur | 1905/09/05 | 1983/03/03 |
7 | Knuth | Donald | 1938/01/10 | — |
8 | Klee | Paul | 1879/12/18 | 1942/06/29 |
9 | Kinski | Klaus | 1926/10/18 | 1991/11/23 |
10 | King | B.B. | 1925/09/16 | 2015/05/14 |
11 | King | Ben E. | 1938/09/28 | 2015/04/30 |
12 | Kilmister | Lemmy | 1945/12/24 | 2015/12/28 |
13 | Kiefer | Anselm | 1945/03/08 | — |
14 | Kerouac | Jack | 1922/03/12 | 1969/10/21 |
15 | Kepler | Johannes | 1571/12/17 | 1630/11/15 |
16 | Kennedy | John F. | 1917/05/29 | 1963/11/22 |
17 | Keitel | Harvey | 1939/05/13 | — |
18 | Keaton | Buster | 1895/10/04 | 1966/02/01 |
19 | Karsh | Yousuf | 1908/12/03 | 2002/07/13 |
20 | Karina | Anna | 1940/09/22 | 2019/12/14 |
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.