Alphapager demo
Showing 1-20 of 33 items.
# | Last Name | First Name | Born | Died |
---|---|---|---|---|
1 | Grunberg | Arnon | 1971/02/22 | — |
2 | Groening | Matt | 1954/02/15 | — |
3 | Grass | Günther | 1927/10/16 | 2015/04/13 |
4 | Grapelli | Stéphane | 1908/01/26 | 1997/12/01 |
5 | Gould | Stephen Jay | 1941/09/10 | 2002/05/20 |
6 | Goscinny | René | 1926/08/14 | 1977/11/05 |
7 | Gordon | Dexter | 1923/02/23 | 1990/04/25 |
8 | Gorbatsjov | Michail | 1931/03/02 | 2022/08/30 |
9 | Gombrowitz | Witold | 1904/08/04 | 1969/07/24 |
10 | Gogol | Nikolai | 1809/03/19 | 1852/03/04 |
11 | Gogh | Theo van | 1957/07/23 | 2004/11/02 |
12 | Gogh | Vincent van | 1853/03/30 | 1890/07/29 |
13 | Goethe | Johann Wolfgang von | 1749/08/28 | 1832/03/22 |
14 | Godard | Jean-Luc | 1930/12/03 | 2022/09/13 |
15 | Glover | Crispin | 1964/04/20 | — |
16 | Gilligan | Vince | 1967/02/10 | — |
17 | Gilliam | Terry | 1940/11/22 | — |
18 | Giger | H.R. | 1940/02/05 | 2014/05/12 |
19 | Ghandi | Mahatma | 1869/10/02 | 1948/01/30 |
20 | Getz | Stan | 1927/02/02 | 1991/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.