fgh151/yii2-grid

Grid view with switchable columns

Installs: 7

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:yii2-extension

pkg:composer/fgh151/yii2-grid

v0.0.4 2025-12-15 09:29 UTC

This package is auto-updated.

Last update: 2025-12-15 09:29:40 UTC


README

Grid view with swithcable columns

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist fgh151/yii2-grid "*"

or add

"fgh151/yii2-grid": "*"

to the require section of your composer.json file.

Usage

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

use fgh151\yii\grid\GridView;

/**
 * @var $dataProvider yii\data\ActiveDataProvider
 * @var $searchModel \yii\db\ActiveRecord
 */

$availableColumns ['id', 'email', 'firstname', 'lastname'];
$defaultColumns = ['id', 'email'];

echo GridView::widget([
        'dataProvider' => $dataProvider, // required
        'filterModel' => $searchModel, // default is null
        'defaultColumns' => $defaultColumns, // default is [], if you want to use default columns
        'availableColumns' => $availableColumns, // default is [], if you want to use default columns
]);