Alphapager advanced
Total 29 items.
# | Last Name | First Name | Born | Died |
---|---|---|---|---|
1 | Ramanujan | Srinivasa Aaiyangar | 1887/12/22 | 1920/04/26 |
2 | Randi | James | 1928/08/07 | 2020/10/20 |
3 | Ray | Man | 1898/08/27 | 1976/11/18 |
4 | Redgrave | Vanessa | 1937/01/30 | — |
5 | Reed | Lou | 1942/03/02 | 2013/10/27 |
6 | Reeve | Christopher | 1952/09/25 | 2004/10/10 |
7 | Reich-Ranicki | Marcel | 1920/06/02 | 2013/09/18 |
8 | Reinhardt | Django | 1910/01/23 | 1953/05/16 |
9 | Reznor | Trent | 1967/05/17 | — |
10 | Rich | Buddy | 1917/09/30 | 1987/04/02 |
11 | Richards | Keith | 1943/12/18 | — |
12 | Richardson | Ian | 1934/04/07 | 2007/02/09 |
13 | Riefenstahl | Leni | 1902/08/22 | 2003/09/09 |
14 | Rietveld | Gerrit | 1888/06/24 | 1964/06/26 |
15 | Rigg | Diana | 1938/07/20 | 2020/09/10 |
16 | Rijn | Rembrandt van | 1606/07/15 | 1669/10/04 |
17 | Roach | Max | 1924/01/10 | 2007/08/16 |
18 | Robinson | Edward G. | 1893/12/12 | 1973/01/26 |
19 | Rodin | Auguste | 1840/11/12 | 1917/11/17 |
20 | Roeg | Nicholas | 1928/08/15 | 2018/11/23 |
21 | Rossellini | Isabella | 1952/06/18 | — |
22 | Rota | Nino | 1911/12/03 | 1979/04/10 |
23 | Rotten | Johnny | 1956/01/31 | — |
24 | Roussel | Raymond | 1877/01/20 | 1933/07/14 |
25 | Rovelli | Carlo | 1956/05/03 | — |
26 | Rubinstein | Arthur | 1887/01/28 | 1982/12/20 |
27 | Rushdie | Salman | 1947/06/19 | — |
28 | Russell | Bertrand | 1872/05/18 | 1970/02/02 |
29 | Russell | Jane | 1921/06/21 | 2011/02/28 |
Yii2 Alphapager lets you do alphabetic paging in the Yii framework 2.0. On this page it is shown with some special settings.
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', 'alphaDigits' => 'compact', // one button for digits '0' - '9' 'alphaPages' => [ 'P' => [ 'label' => 'pq', // label button 'P' with 'pq' 'pattern' => [ '[PpQq]' ], // regular expression: include words starting with 'Q' under 'P' ], 'Q' => false, // suppress page 'Q' 'Z' => [ 'label' => 'x-z', // label button 'Z' with 'x-z' 'pattern' => [ '[X-Zx-z]' ], // regular expression: include words starting with 'X' or 'Y' under 'Z' ], 'X' => false, // suppress page 'X' 'Y' => false, // suppress page 'Y' ], 'pagination' => false // switch off normal pagination ]); ?> <?= AlphaPager::widget([ 'dataProvider' => $dataProvider, 'preButtons' => [], // no 'all' button 'lowerCase' => true // buttons in lower case ]) ?> <?= GridView::widget([ 'dataProvider' => $dataProvider, 'columns' => [ ['class' => 'yii\grid\SerialColumn'], 'last_name:ntext', 'first_name:ntext', 'born:date', 'died:date', ], ]); ?>
A basic example is here.