This is an issue in Yii2, latest version.
'columns' => [
[
'attribute' => 'id',
'label' => 'My Label',
'format' => 'html',
'value' => function($model) {
return ($model->status !== SomeClass::CONST_STATUS)?$model->id:Html::a('External Link','http://my_link_goes_here', ['class' => 'btn btn-sm btn-info', 'target' => '_blank']);
},
],
With this code, due to the format => html, any other attribute of the a element, even id, does not show up. Only class shows up and can be modified; and ofcourse href.