PHPackages                             loop8/yii2-l8-actioncolumn - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. loop8/yii2-l8-actioncolumn

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

loop8/yii2-l8-actioncolumn
==========================

Adds functions to get default button markup

v2.0.0(1y ago)0748MITJavaScriptPHP &gt;=7.3

Since Jan 18Pushed 1y ago2 watchersCompare

[ Source](https://github.com/Loop8/yii2-l8-actioncolumn)[ Packagist](https://packagist.org/packages/loop8/yii2-l8-actioncolumn)[ RSS](/packages/loop8-yii2-l8-actioncolumn/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Extended ActionColumn for YII2 GridView
=======================================

[](#extended-actioncolumn-for-yii2-gridview)

Adds functions to get default button markup

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist loop8/yii2-l8-actioncolumn "*"

```

or add

```
"loop8/yii2-l8-actioncolumn": "*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

This extension adds the following static functions to the ActionColumn:

- L8ActionColumn::viewButton($url, $model, $key, $visible = true)
- L8ActionColumn::updateButton($url, $model, $key, $visible = true)
- L8ActionColumn::deleteButton($url, $model, $key, $visible = true)
- L8ActionColumn::ajaxDeleteButton($url, $model, $key, $visible = true, $options = \[\])

These functions can be used to render or hide the default `ActionColumn` buttons depending on the `visible` flag. This saved you from having to rewrite the default button markup in every `GridView` widget. The `L8ActionColumn::ajaxDeleteButton` function adds an `options` array which can be used to pass data to the ajax call and the button will have a CSS class name `l8ajax-delete` which you can use for event binding.

Once the extension is installed, simply use it in your code by:

```

```

and using it in your view files with GridView:

```
