Hello,
I have a Gridview where the number of columns is dynamic, so I do not know the column names ahead of time. My code to display the Gridview looks like this:
echo GridView::widget([
'dataProvider' => $provider,
'formatter' => ['class' => 'yii\i18n\Formatter','nullDisplay' => 'X'],
'options' => [
'class' => 'YourCustomTableClass',
],
'columns' => $columns,
]);
My column values will either be a value of ‘YES’, or null (not set)… If the value is ‘YES’, I want to format the value to be a html check mark, or maybe color that cell a different color.
But how could I do that without specifying out all the columns? Normally I would list out all the columns and do an anonymous function to return a custom value. Would I use some type of anonymous function for ‘columns’ => $columns ?
My output looks like this, its essentially a matrix: