pheme/yii2-toggle-column Provides a toggle data column and action

extensiontogglecolumn

Toggle data column for Yii2

Provides a toggle data column and action

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist pheme/yii2-toggle-column "*"

or add

"pheme/yii2-toggle-column": "*"

to the require section of your composer.json file.

Usage

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

// In your Controller
use pheme\grid\actions\ToggleAction;

public function actions()
{
    return [
        'toggle' => [
            'class' => ToggleAction::className(),
            'modelClass' => 'path\to\your\Model',
            // Uncomment to enable flash messages
            //'setFlash' => true,
        ]
    ];
}

// In your view
use yii\grid\GridView;
use yii\widgets\Pjax;

Pjax::begin();

GridView::widget(
    [
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            'id',
            [
                'class' => '\pheme\grid\ToggleColumn',
                'attribute' => 'active',
                // Uncomment if  you don't want AJAX
                // 'enableAjax' => false,
            ],
            ['class' => 'yii\grid\ActionColumn'],
        ],
    ]
);

Pjax::end();

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

  • 0.809 July 2020
  • 0.723 December 2016
  • 0.610 October 2016
  • 0.509 September 2016
  • 0.420 May 2016
  • 0.310 March 2016
  • 0.207 August 2015
  • 0.112 October 2014

Comments



0.8 is the latest of 8 releases



MIT license
Stats
23 github stars & 21 github forks
286 downloads in the last day
7085 downloads in the last 30 days
664833 total downloads