Commit 6cea5205 authored by Marc Mautz's avatar Marc Mautz Committed by GitHub

Added color column example

parent 16d7eb14
......@@ -103,6 +103,21 @@ $columnFormats = [
];
```
Renders a color column
```php
$colorColumn = function ($attribute, $model, $generator) {
return <<<FORMAT
[
'attribute' => '{$attribute}',
'format' => 'raw',
'value' => function (\$model) {
return \yii\helpers\Html::tag('div', '', ['style' => 'background-color: '.\$model->{$attribute}.'; width: 30px; height: 30px;']);
},
]
FORMAT;
};
```
Define callbacks for grid columns in `index` view
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment