Alphapager advanced
Total 34 items.
| # | Last Name | First Name | Born | Died |
|---|---|---|---|---|
| 1 | Pacino | Al | 1940/04/24 | — |
| 2 | Page | Bettie | 1923/04/21 | 2008/12/11 |
| 3 | Paik | Nam June | 1932/07/20 | 2006/01/29 |
| 4 | Palahniuk | Chuck | 1962/02/21 | — |
| 5 | Palin | Michael | 1943/05/05 | — |
| 6 | Palma | Brian De | 1940/09/11 | — |
| 7 | Palmer | Robert | 1949/01/19 | 2003/09/26 |
| 8 | Panamarenko | 1940/12/05 | 2019/12/14 | |
| 9 | Parker | Trey | 1969/10/19 | — |
| 10 | Pasolini | Pier Paolo | 1922/03/05 | 1973/04/08 |
| 11 | Paul | Aaron | 1979/08/27 | — |
| 12 | Paul | Les | 1915/06/08 | 2009/08/13 |
| 13 | Paxman | Jeremy | 1950/05/11 | — |
| 14 | Pennebaker | D.A. | 1925/07/15 | 2019/08/01 |
| 15 | Peterson | Oscar | 1925/08/15 | 2007/12/23 |
| 16 | Petty | Tom | 1950/10/20 | 2017/10/02 |
| 17 | Picasso | Pablo | 1881/10/25 | 1973/04/08 |
| 18 | Piccoli | Michel | 1925/12/27 | 2020/05/12 |
| 19 | Pinter | Harold | 1930/10/10 | 2008/12/24 |
| 20 | Planck | Max | 1858/04/23 | 1947/10/03 |
| 21 | Plant | Robert | 1948/08/20 | — |
| 22 | Poe | Edgar Allan | 1809/01/19 | 1849/10/07 |
| 23 | Poitier | Sidney | 1927/02/20 | 2022/01/06 |
| 24 | Polanski | Roman | 1933/08/18 | — |
| 25 | Pollock | Jackson | 1912/01/28 | 1956/08/11 |
| 26 | Polster | Burkard | 1965/02/26 | — |
| 27 | Pontiac | Peter | 1951/04/28 | 2015/01/20 |
| 28 | Pop | Iggy | 1947/04/21 | — |
| 29 | Potter | Dennis | 1935/05/17 | 1994/06/07 |
| 30 | Presley | Elvis | 1935/01/08 | 1977/08/16 |
| 31 | Presley | Reg | 1941/06/12 | 2013/02/04 |
| 32 | Prince | 1958/06/07 | 2016/04/21 | |
| 33 | Proust | Marcel | 1871/07/10 | 1922/11/18 |
| 34 | Queneau | Raymond | 1903/02/21 | 1976/10/25 |
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.