Skip to content

Commit 6cb3b31

Browse files
author
Christoph Erdmann
committed
Merge remote-tracking branch 'origin/develop'
2 parents 578db89 + c845ee1 commit 6cb3b31

File tree

4 files changed

+72
-4
lines changed

4 files changed

+72
-4
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ The following widgets are currently available:
6969
* Fixed Action Button
7070
* GridView with ActionColumn
7171
* Icon
72+
* LinkPager
7273
* Modal
7374
* Nav
7475
* NavBar
@@ -135,6 +136,10 @@ You can find the sample layout file in ```src/layout/main.php```.
135136

136137
## Change log
137138

139+
### 1.3.0 - 2017-03-02
140+
* added [LinkPager](https://github.com/MacGyer/yii2-materializecss/blob/master/src/widgets/grid/LinkPager.php): set [LinkPager]() as default pager class
141+
* [GridView](https://github.com/MacGyer/yii2-materializecss/blob/master/src/widgets/grid/GridView.php): set [LinkPager](https://github.com/MacGyer/yii2-materializecss/blob/master/src/widgets/grid/LinkPager.php) as default pager class
142+
138143
### 1.2.1 - 2017-02-05
139144
* [Select](https://github.com/MacGyer/yii2-materializecss/blob/master/src/widgets/form/Select.php): added multiple property
140145
* Composer dependency for Yii restricted to ~2.0.0

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"role": "Developer"
1414
}
1515
],
16-
"version": "1.2.1",
16+
"version": "1.3.0",
1717
"require": {
1818
"php": ">=5.6.0",
1919
"yiisoft/yii2": "~2.0.0",

src/widgets/grid/GridView.php

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
namespace macgyer\yii2materializecss\widgets\grid;
99

10+
use yii\helpers\ArrayHelper;
11+
1012
/**
1113
* The GridView widget is used to display data in a grid.
1214
*
@@ -30,7 +32,7 @@
3032
* which are configured via [yii\grid\GridView::$columns](http://www.yiiframework.com/doc-2.0/yii-grid-gridview.html#$columns-detail).
3133
*
3234
* The look and feel of a grid view can be customized using the large amount of properties.
33-
*
35+
*
3436
* @author Christoph Erdmann <[email protected]>
3537
* @package widgets
3638
* @subpackage grid
@@ -39,8 +41,30 @@ class GridView extends \yii\grid\GridView
3941
{
4042
/**
4143
* @var array the HTML attributes for the grid table element.
42-
* @see [yii\helpers\BaseHtml::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on
43-
* how attributes are being rendered.
44+
* @see [\yii\helpers\Html::renderTagAttributes()](http://www.yiiframework.com/doc-2.0/yii-helpers-basehtml.html#renderTagAttributes()-detail) for details on how attributes are being rendered.
4445
*/
4546
public $tableOptions = ['class' => 'table striped bordered'];
47+
48+
/**
49+
* @var array the configuration for the pager widget. By default, [LinkPager](http://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html)
50+
* will be used to render the pager. You can use a different widget class by configuring the "class" element.
51+
* Note that the widget must support the `pagination` property which will be populated with the
52+
* [$pagination](http://www.yiiframework.com/doc-2.0/yii-data-basedataprovider.html#$pagination-detail) value of
53+
* the [$dataProvider](http://www.yiiframework.com/doc-2.0/yii-widgets-baselistview.html#$dataProvider-detail).
54+
*/
55+
public $pager = [];
56+
57+
/**
58+
* Initializes the widget.
59+
*/
60+
public function init()
61+
{
62+
parent::init();
63+
64+
if (is_array($this->pager) && !ArrayHelper::keyExists('class', $this->pager)) {
65+
$this->pager = [
66+
'class' => LinkPager::className(),
67+
];
68+
}
69+
}
4670
}

src/widgets/grid/LinkPager.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* @link https://github.com/MacGyer/yii2-materializecss
4+
* @copyright Copyright (c) 2016 ... MacGyer for pluspunkt coding
5+
* @license https://github.com/MacGyer/yii2-materializecss/blob/master/LICENSE
6+
*/
7+
8+
namespace macgyer\yii2materializecss\widgets\grid;
9+
10+
/**
11+
* LinkPager displays a list of hyperlinks that lead to different pages of target.
12+
*
13+
* @author Christoph Erdmann <[email protected]>
14+
* @package widgets
15+
* @subpackage data
16+
* @see [\yii\widgets\LinkPager](http://www.yiiframework.com/doc-2.0/yii-widgets-linkpager.html)
17+
*/
18+
class LinkPager extends \yii\widgets\LinkPager
19+
{
20+
/**
21+
* @var string|bool the label for the "next" page button. Note that this will NOT be HTML-encoded.
22+
* If this property is false, the "next" page button will not be displayed.
23+
*/
24+
public $nextPageLabel = '<i class="material-icons">chevron_right</i>';
25+
26+
/**
27+
* @var string|bool the label for the "previous" page button. Note that this will NOT be HTML-encoded.
28+
* If this property is false, the "previous" page button will not be displayed.
29+
*/
30+
public $prevPageLabel = '<i class="material-icons">chevron_left</i>';
31+
32+
/**
33+
* Initializes the widget.
34+
*/
35+
public function init()
36+
{
37+
parent::init();
38+
}
39+
}

0 commit comments

Comments
 (0)