0

Yii2 – Custom ActionColumn

ActionColumn is a column for the yii\grid\GridView widget that displays buttons for viewing and manipulating the items.

To add an ActionColumn to the gridview, add it to the columns configuration as follows: The function parameter should be like this ‘function ($model, $key, $index, $column){}’ and it will return the array with different type of attribute for cells like class, style, data-key, etc

Initializes the default button rendering callback for single button.
@param string $name Button name as it’s written in template
@param string $iconName The part of Bootstrap glyphicon class that makes it unique
@param array $additionalOptions Array of additional options
@since 2.0.11

Custom entire project in ActionColumn: In vendor\yiisoft\yii2\grid\ActionColumn.php file

Default:

ActionColumn

 

Custom Button Style & Icons:

ActionColumn

 

Hide Actions in Action Column of a Single Row

Hide Actions in Action Column

 

 Add the new button in gridview action template and configure the url, text, title etc.

Add Actions in Action Column

 

Prakash S

Prakash S

I would like to introduce myself as a Software professional opting for the career in software industry. I'm Prakash S, a MCA graduate and trained as industry level practice for Software technology. Basically I am a PHP Developer but now days exploring more in HTML5, CSS, AngularJS and jQuery libraries.