Alphapager demo
Showing 1-20 of 53 items.
# | Last Name | First Name | Born | Died |
---|---|---|---|---|
1 | Ma | Yo-Yo | 1955/10/07 | — |
2 | MacFarlane | Seth | 1973/10/26 | — |
3 | MacKay | George | 1992/03/13 | — |
4 | Macnee | Patrick | 1922/02/06 | 2015/06/25 |
5 | Madonna | 1959/08/16 | — | |
6 | Mailer | Norman | 1923/01/31 | 2007/11/10 |
7 | Malevitsj | Kazimir | 1878/02/23 | 1935/05/15 |
8 | Malkovich | John | 1953/12/09 | — |
9 | Mandela | Nelson | 1918/07/18 | 2013/12/05 |
10 | Mandelbrot | Benoît | 1924/11/20 | 2010/10/14 |
11 | Mann | Thomas | 1875/06/06 | 1955/08/12 |
12 | Manzarek | Ray | 1939/02/12 | 2013/05/20 |
13 | Marley | Bob | 1945/02/06 | 1981/05/11 |
14 | Márquez | Gabriel García | 1927/03/06 | 2014/04/17 |
15 | Martin | Don | 1931/05/18 | 2000/01/06 |
16 | Martin | George | 1926/01/03 | 2016/03/08 |
17 | Marx | Groucho | 1895/10/02 | 1977/08/18 |
18 | Mastroianni | Marcello | 1923/09/28 | 1996/12/19 |
19 | Mata Hari | 1876/08/07 | 1917/10/15 | |
20 | Matisse | Henri | 1869/12/31 | 1954/11/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.