2017 © Pedro Peláez
 

yii2-extension yii2-bulkactionscheckboxcolumn

Bulk actions checkbox column

image

integready/yii2-bulkactionscheckboxcolumn

Bulk actions checkbox column

  • Friday, May 25, 2018
  • by Stern87
  • Repository
  • 2 Watchers
  • 1 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 7 % Grown

The README.md

Bulk actions checkbox column

Installation

The preferred way to install this extension is through composer., (*1)

Either run, (*2)

composer require --prefer-dist integready/yii2-bulkactionscheckboxcolumn "~1.0"

or add, (*3)

"integready/yii2-bulkactionscheckboxcolumn": "~1.0"

to the require section of your composer.json file., (*4)

Usage example:

GridView id must be set.
  • index.php (View): > Only one button is type to BulkCheckboxColumn::BUTTON_TYPE_CUSTOM_JS!

= GridView::widget([
    'id'            => 'books-grid',
    'dataProvider'  => $dataProvider,
    'filterModel'   => $searchModel,
    'layout'        => '{toolbar}\n{summary}\n{items}\n{pager}', // {toolbar} must be included in 'layout' section
    'columns'       => [
        [
            'class'     => BulkCheckboxColumn::className(),
            'elements'  => [
                [
                    'label'         => 'Change Availability',
                    'field'         => 'available',
                    'buttonClass'   => 'btn btn-primary',
                    'buttonOptions' => [
                        'data' => [
                            'button' => 'change',
                        ],
                    ],
                    'items'         => [
                        1 => 'Yes',
                        0 => 'No',
                    ],
                    'visible'       => false,
                ],
                [
                    'label'         => 'Change International Shipping',
                    'field'         => 'intl_shipping',
                    'buttonClass'   => 'btn btn-success',
                    'items'         => [
                        1 => 'Yes',
                        0 => 'No',
                    ],
                ],
                [
                    'label'         => 'Change Author',
                    'field'         => 'author_book',
                    'buttonClass'   => 'btn btn-info',
                    'buttonType'    => BulkCheckboxColumn::BUTTON_TYPE_CUSTOM_JS,
                    'customJs'      => 'function(event, gridId, ids) { /* ... */ }',
                ]
                // ...Other elements
            ],
        ],
        // Other columns
    ],
]); ?>
  • BookController.php (Controller):
<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;
use backend\models\Book;
use yii\helpers\ArrayHelper;
use backend\models\BookSearch;

/**
 * BookController implements the CRUD actions for Site model.
 */
class BookController extends Controller
{
    /**
     * @inheritdoc
     */
    public function actions()
    {
        return ArrayHelper::merge(parent::actions(), [
            'bulk_available'        => [
                'class'                 => BulkCheckboxAction::className(),
                'modelClass'            => Book::className(),
                'gridId'                => 'books-grid',
                'statusField'           => 'available',
                'updateType'            => BulkCheckboxAction::UPDATE_TYPE_ONEBYONE,
            ],
            // ...Many actions
            'bulk_intl_shipping'    => [
                'class'                 => BulkCheckboxAction::className(),
                'modelClass'            => Book::className(),
                'gridId'                => 'books-grid',
                'statusField'           => 'intl_shipping',
            ],
        ]);
    }

    /**
     * Index page
     *
     * @return mixed
     */
    public function actionIndex()
    {
        $this->runAction('bulk_available');
        // ...Many actions with run
        $this->runAction('bulk_intl_shipping');

        $searchModel  = new BookSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);

        return $this->render('index', [
            'searchModel'  => $searchModel,
            'dataProvider' => $dataProvider,
        ]);
    }

    // Other actions and methods
}

The Versions

25/05 2018

dev-master

9999999-dev

Bulk actions checkbox column

  Sources   Download

BSD-3-Clause

The Requires

 

by Viktor Chistyakov

extension yii2

10/04 2018

1.0.5

1.0.5.0

Bulk actions checkbox column

  Sources   Download

BSD-3-Clause

The Requires

 

by Viktor Chistyakov

extension yii2

06/04 2018

1.0.4

1.0.4.0

Bulk actions checkbox column

  Sources   Download

BSD-3-Clause

The Requires

 

by Viktor Chistyakov

extension yii2

23/03 2018

1.0.3

1.0.3.0

Bulk actions checkbox column

  Sources   Download

BSD-3-Clause

The Requires

 

by Viktor Chistyakov

extension yii2

26/02 2018

1.0.2

1.0.2.0

Bulk actions checkbox column

  Sources   Download

BSD-3-Clause

The Requires

 

by Viktor Chistyakov

extension yii2

06/02 2018

1.0.1

1.0.1.0

Bulk actions checkbox column

  Sources   Download

BSD-3-Clause

The Requires

 

by Viktor Chistyakov

extension yii2

05/02 2018

1.0.0.1

1.0.0.1

Bulk actions checkbox column

  Sources   Download

BSD-3-Clause

The Requires

 

by Viktor Chistyakov

extension yii2

02/02 2018

1.0

1.0.0.0

Bulk actions checkbox column

  Sources   Download

BSD-3-Clause

The Requires

 

by Viktor Chistyakov

extension yii2