1 | <?php |
||
29 | class GridView extends \yii\grid\GridView |
||
30 | { |
||
31 | /** |
||
32 | * {@inheritdoc} |
||
33 | */ |
||
34 | public $dataColumnClass = DataColumn::class; |
||
35 | |||
36 | /** |
||
37 | * {@inheritdoc} |
||
38 | */ |
||
39 | public $detailViewClass = DetailView::class; |
||
40 | |||
41 | /** |
||
42 | * @var array|boolean |
||
43 | * - array: options for Jquery Resizable Columns plugin initiate call |
||
44 | * - boolean false: resizable is disabled |
||
45 | * |
||
46 | * Defaults to `['store' => new JsExpression('store')]` |
||
47 | * @see registerResizableColumns() |
||
48 | */ |
||
49 | public $resizableColumns = []; |
||
50 | |||
51 | public function run() |
||
56 | |||
57 | /** |
||
58 | * {@inheritdoc} |
||
59 | */ |
||
60 | public function getId($autoGenerate = true) |
||
68 | |||
69 | /** |
||
70 | * Registers ResizableColumns plugin when [[resizableColumns]] is not false. |
||
71 | * TODO: move somewhere |
||
72 | */ |
||
73 | public function registerResizableColumns() |
||
87 | |||
88 | /** |
||
89 | * Runs DetailView widget based on this GridView. |
||
90 | * |
||
91 | * @param array $config Config that will be passed to [[detailViewClass]] initialisation. |
||
92 | * Special element `gridOptions` will be merged to `GridView` initialisation config array. |
||
93 | * |
||
94 | * @throws \yii\base\InvalidConfigException |
||
95 | * |
||
96 | * @return mixed |
||
97 | */ |
||
98 | public static function detailView(array $config = []) |
||
110 | |||
111 | /** |
||
112 | * Returns array of columns configurations that will be used by widget to create |
||
113 | * data columns and render them. |
||
114 | * |
||
115 | * Array format: |
||
116 | * key - column alias |
||
117 | * value - column configuration array |
||
118 | * |
||
119 | * Example: |
||
120 | * |
||
121 | * ```php |
||
122 | * return [ |
||
123 | * 'login_and_avatar' => [ |
||
124 | * 'format' => 'raw', |
||
125 | * 'value' => function ($model) { |
||
126 | * return Html::img($model->avatar) . $model->username; |
||
127 | * } |
||
128 | * ] |
||
129 | * ]; |
||
130 | * ``` |
||
131 | * |
||
132 | * Despite model does not have a `login_and_avatar` attribute, the following widget call will |
||
133 | * use the definition above to render value: |
||
134 | * |
||
135 | * ```php |
||
136 | * echo GridView::widget([ |
||
137 | * 'dataProvider' => $dataProvider, |
||
138 | * 'columns' => ['login_and_avatar', 'status', 'actions'], |
||
139 | * ]); |
||
140 | * ``` |
||
141 | * |
||
142 | * @return array |
||
143 | */ |
||
144 | public function columns() |
||
148 | |||
149 | /** |
||
150 | * Creates a [[DataColumn]] object with given config. |
||
151 | * |
||
152 | * @param array $config config for [[DataColumn]] |
||
153 | * @return DataColumn the column instance |
||
154 | */ |
||
155 | protected function createDataColumnByConfig(array $config = []) |
||
162 | |||
163 | /** |
||
164 | * {@inheritdoc} |
||
165 | */ |
||
166 | protected function createDataColumn($text) |
||
177 | |||
178 | /** |
||
179 | * @var Closure use it to change default summary rendering |
||
180 | * Method signature: |
||
181 | * |
||
182 | * ```php |
||
183 | * function ($grid, $defaultSummaryCallback) |
||
184 | * ``` |
||
185 | * |
||
186 | * Argument `$defaultSummaryCallback` will contain a Closure that will |
||
187 | * render default summary. |
||
188 | * ``` |
||
189 | * |
||
190 | */ |
||
191 | public $summaryRenderer; |
||
192 | |||
193 | /** |
||
194 | * {@inheritdoc} |
||
195 | */ |
||
196 | public function renderSummary() |
||
206 | } |
||
207 |