1 | <?php |
||
25 | * Class GridView. |
||
26 | * HiPanel specific GridView. |
||
27 | */ |
||
28 | class GridView extends \hiqdev\higrid\GridView |
||
29 | { |
||
30 | public $sorter = [ |
||
31 | 'class' => LinkSorter::class, |
||
32 | ]; |
||
33 | |||
34 | /** |
||
35 | * {@inheritdoc} |
||
36 | */ |
||
37 | public $resizableColumns = [ |
||
38 | 'resizeFromBody' => false, |
||
39 | ]; |
||
40 | |||
41 | /** |
||
42 | * {@inheritdoc} |
||
43 | */ |
||
44 | public $options = [ |
||
45 | 'class' => 'dataTables_wrapper form-inline', |
||
46 | 'role' => 'grid', |
||
47 | ]; |
||
48 | |||
49 | /** |
||
50 | * {@inheritdoc} |
||
51 | */ |
||
52 | public $layout = "<div class='row'><div class='col-xs-12'>{sorter}</div></div><div class=\"table-responsive\">{items}</div>\n<div class='row'><div class='col-sm-6 col-xs-12'><div class='dataTables_info'>{summary}</div></div>\n<div class='col-sm-6 col-xs-12'><div class='dataTables_paginate paging_bootstrap'>{pager}</div></div></div>"; |
||
53 | |||
54 | |||
55 | public function init() |
||
56 | { |
||
57 | parent::init(); |
||
58 | |||
59 | if ($this->dataProvider instanceof ActiveDataProvider && $this->dataProvider->countSynchronously === false) { |
||
60 | $this->pager = ['class' => PagerHook::class]; |
||
61 | $this->summaryRenderer = static fn() => SummaryHook::widget(); |
||
|
|||
62 | } |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * {@inheritdoc} |
||
67 | */ |
||
68 | public function columns() |
||
69 | { |
||
70 | return array_merge(parent::columns(), [ |
||
71 | 'seller_id' => [ |
||
72 | 'class' => SellerColumn::class, |
||
73 | ], |
||
74 | 'client_id' => [ |
||
75 | 'class' => ClientColumn::class, |
||
76 | ], |
||
77 | 'checkbox' => [ |
||
78 | 'class' => CheckboxColumn::class, |
||
79 | ], |
||
80 | 'seller' => [ |
||
81 | 'class' => SellerColumn::class, |
||
82 | 'attribute' => 'seller_id', |
||
83 | ], |
||
84 | 'client' => [ |
||
85 | 'class' => ClientColumn::class, |
||
86 | 'attribute' => 'client_id', |
||
87 | ], |
||
88 | 'client_like' => [ |
||
89 | 'class' => ClientColumn::class, |
||
90 | 'filterOptions' => ['class' => 'narrow-filter'], |
||
91 | ], |
||
92 | 'blocking' => [ |
||
93 | 'label' => Yii::t('hipanel', 'Block'), |
||
94 | 'class' => BlockingColumn::class, |
||
95 | ], |
||
96 | ]); |
||
97 | } |
||
98 | |||
99 | /** |
||
100 | * {@inheritdoc} |
||
101 | */ |
||
102 | public function run() |
||
103 | { |
||
104 | $this->tableOptions['class'] .= ' ' . Yii::$app->themeManager->settings->getCssClass('table_condensed'); |
||
105 | parent::run(); |
||
106 | $this->registerClientScript(); |
||
107 | } |
||
108 | |||
109 | /** |
||
110 | * {@inheritdoc} |
||
111 | */ |
||
112 | public static function detailView(array $config = []) |
||
113 | { |
||
114 | $config = ArrayHelper::merge(['gridOptions' => ['resizableColumns' => ['resizeFromBody' => true]]], $config); |
||
115 | |||
129 |