I want to hide Yii2 GridView Action Column buttons on the base of model field status. If status is = 1 then hide view button only. How I can?
Code:
This is what I have done https://github.com/Mihai-P/yii2theme-brain/blob/master/widgets/ActionColumn.php in short I have extended the ActionColumn class and use my own instead of the default one. my class has more things in it, like checking for access privileges and showing only the buttons they have access to, you can ignore that part and just use the way to check for the way to check for the model. I consider this more reusable then writing code in the view. If you start writing code in the view then you have to write the same code over and over again for each screen.
I am sure you can also do what you want inside the view, try using
'template' => function ($model) {
.............
}
And return either '{view} {delete}' or '{delete}'