Commit 3dac6dc7 authored by Tobias Munk's avatar Tobias Munk Committed by GitHub

Merge pull request #186 from marc7000/patch-1

Added color column example
parents 16d7eb14 6cea5205
......@@ -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