/
GridView.php
50 lines (36 loc) · 1.01 KB
/
GridView.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace machour\yii2\adminlte\widgets;
use yii\grid\GridView as BaseGridView;
class GridView extends BaseGridView
{
use BoxTrait;
public $type = 'table-bordered';
public $responsive = true;
public $layout = '{items}
<div>
<div class="pull-left">{summary}</div>
<div class="pull-right">{pager}</div>
<div style="clear: both;"></div>
</div>';
public function init()
{
$this->tableOptions = ['class' => 'table ' . $this->type];
parent::init();
}
public function run() {
if ($this->box) {
if ($this->responsive) {
$this->box['body']['class'] = 'table-responsive';
}
self::boxBegin($this->box);
} elseif ($this->responsive) {
Html::beginTag('div', ['class' => 'table-responsive']);
}
parent::run();
if ($this->box) {
self::boxEnd();
} elseif ($this->responsive) {
Html::endTag('div');
}
}
}