2017 © Pedro Peláez
 

yii2-extension yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

image

kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  • Friday, July 20, 2018
  • by kartik-v
  • Repository
  • 59 Watchers
  • 433 Stars
  • 960,436 Installations
  • PHP
  • 210 Dependents
  • 0 Suggesters
  • 268 Forks
  • 89 Open issues
  • 37 Versions
  • 8 % Grown

The README.md

Krajee Logo
yii2-grid
Donate       kartikv

[![Financial Contributors on Open Collective](https://opencollective.com/yii2-grid/all/badge.svg?label=financial+contributors)](https://opencollective.com/yii2-grid) [![Stable Version](https://poser.pugx.org/kartik-v/yii2-grid/v/stable)](https://packagist.org/packages/kartik-v/yii2-grid) [![Unstable Version](https://poser.pugx.org/kartik-v/yii2-grid/v/unstable)](https://packagist.org/packages/kartik-v/yii2-grid) [![License](https://poser.pugx.org/kartik-v/yii2-grid/license)](https://packagist.org/packages/kartik-v/yii2-grid) [![Total Downloads](https://poser.pugx.org/kartik-v/yii2-grid/downloads)](https://packagist.org/packages/kartik-v/yii2-grid) [![Monthly Downloads](https://poser.pugx.org/kartik-v/yii2-grid/d/monthly)](https://packagist.org/packages/kartik-v/yii2-grid) [![Daily Downloads](https://poser.pugx.org/kartik-v/yii2-grid/d/daily)](https://packagist.org/packages/kartik-v/yii2-grid)

Yii2 GridView on steroids. A module with various modifications and enhancements to one of the most used widgets by Yii developers. The widget contains new additional Grid Columns with enhanced settings for Yii Framework 2.0. The widget also incorporates various Bootstrap 3.x styling options. Refer detailed documentation and/or a complete demo. You can also view the grid grouping demo here., (*1)

GridView Screenshot, (*2)

Docs & Demo

You can see detailed documentation, demonstration and API code documentation on usage of the extension. You can also view the grid grouping demo here., (*3)

Note: If you face an issue of bootstrap popovers loading on page load for editable columns - you can disable it by hiding the bootstrap popovers in your yii2 view layout after document ready. For example in your yii2 view layout:, (*4)

<script>
$(document).on("ready", function() {
    $('.popover-x:visible').popoverX('hide'); // or use the right CSS selector as per your need
});
</script>

Installation

The preferred way to install this extension is through composer. Read this web tip /wiki on setting the minimum-stability settings for your application's composer.json., (*5)

Pre-requisites

Install the necessary pre-requisite (Krajee Dropdown Extension) based on your bootstrap version:, (*6)

  • For Bootstrap v5.x install the extension kartik-v/yii2-bootstrap5-dropdown
  • For Bootstrap v4.x install the extension kartik-v/yii2-bootstrap4-dropdown
  • For Bootstrap v3.x install the extension kartik-v/yii2-dropdown-x

For example if you are using the Bootstrap v5.x add the following to the require section of your composer.json file:, (*7)

"kartik-v/yii2-bootstrap5-dropdown": "@dev"

Install

Either run:, (*8)

$ php composer.phar require kartik-v/yii2-grid "@dev"

or add, (*9)

"kartik-v/yii2-grid": "@dev"

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

Usage

use kartik\grid\GridView;
$gridColumns = [
    ['class' => 'kartik\grid\SerialColumn'],
    [
        'class' => 'kartik\grid\EditableColumn',
        'attribute' => 'name',
        'pageSummary' => 'Page Total',
        'vAlign'=>'middle',
        'headerOptions'=>['class'=>'kv-sticky-column'],
        'contentOptions'=>['class'=>'kv-sticky-column'],
        'editableOptions'=>['header'=>'Name', 'size'=>'md']
    ],
    [
        'attribute'=>'color',
        'value'=>function ($model, $key, $index, $widget) {
            return "<span class='badge' style='background-color: {$model->color}'> </span>  <code>" . 
                $model->color . '</code>';
        },
        'filterType'=>GridView::FILTER_COLOR,
        'vAlign'=>'middle',
        'format'=>'raw',
        'width'=>'150px',
        'noWrap'=>true
    ],
    [
        'class'=>'kartik\grid\BooleanColumn',
        'attribute'=>'status', 
        'vAlign'=>'middle',
    ],
    [
        'class' => 'kartik\grid\ActionColumn',
        'dropdown' => true,
        'vAlign'=>'middle',
        'urlCreator' => function($action, $model, $key, $index) { return '#'; },
        'viewOptions'=>['title'=>$viewMsg, 'data-toggle'=>'tooltip'],
        'updateOptions'=>['title'=>$updateMsg, 'data-toggle'=>'tooltip'],
        'deleteOptions'=>['title'=>$deleteMsg, 'data-toggle'=>'tooltip'], 
    ],
    ['class' => 'kartik\grid\CheckboxColumn']
];
echo GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => $gridColumns,
    'containerOptions' => ['style'=>'overflow: auto'], // only set when $responsive = false
    'beforeHeader'=>[
        [
            'columns'=>[
                ['content'=>'Header Before 1', 'options'=>['colspan'=>4, 'class'=>'text-center warning']], 
                ['content'=>'Header Before 2', 'options'=>['colspan'=>4, 'class'=>'text-center warning']], 
                ['content'=>'Header Before 3', 'options'=>['colspan'=>3, 'class'=>'text-center warning']], 
            ],
            'options'=>['class'=>'skip-export'] // remove this row from export
        ]
    ],
    'toolbar' =>  [
        ['content'=>
            Html::button('&lt;i class="glyphicon glyphicon-plus">&lt;/i>', ['type'=>'button', 'title'=>Yii::t('kvgrid', 'Add Book'), 'class'=>'btn btn-success', 'onclick'=>'alert("This will launch the book creation form.\n\nDisabled for this demo!");']) . ' '.
            Html::a('&lt;i class="glyphicon glyphicon-repeat">&lt;/i>', ['grid-demo'], ['data-pjax'=>0, 'class' => 'btn btn-default', 'title'=>Yii::t('kvgrid', 'Reset Grid')])
        ],
        '{export}',
        '{toggleData}'
    ],
    'pjax' => true,
    'bordered' => true,
    'striped' => false,
    'condensed' => false,
    'responsive' => true,
    'hover' => true,
    'floatHeader' => true,
    'floatHeaderOptions' => ['top' => $scrollingTop],
    'showPageSummary' => true,
    'panel' => [
        'type' => GridView::TYPE_PRIMARY
    ],
]);

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute], (*11)

, (*12)

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute], (*13)

Individuals

, (*14)

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute], (*15)

, (*16)

License

yii2-grid is released under the BSD-3-Clause License. See the bundled LICENSE.md for details., (*17)

The Versions

20/07 2018

dev-master

9999999-dev https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

18/07 2018

v3.1.8

3.1.8.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

23/11 2017

v3.1.7

3.1.7.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

22/10 2017

v3.1.6

3.1.6.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

09/06 2017

v3.1.5

3.1.5.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

08/06 2017

v3.1.4

3.1.4.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

22/10 2016

v3.1.3

3.1.3.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

16/08 2016

v3.1.2

3.1.2.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

09/04 2016

v3.1.1

3.1.1.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

14/01 2016

v3.1.0

3.1.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

10/01 2016

v3.0.9

3.0.9.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

05/12 2015

v3.0.8

3.0.8.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

12/09 2015

v3.0.7

3.0.7.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

14/07 2015

v3.0.6

3.0.6.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

07/07 2015

v3.0.5

3.0.5.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

24/06 2015

v3.0.4

3.0.4.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

16/06 2015

v3.0.3

3.0.3.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD-3-Clause

The Requires

 

extension yii2 widget grid

10/05 2015

v3.0.2

3.0.2.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

30/04 2015

dev-revert-284-master

dev-revert-284-master https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

25/03 2015

v3.0.1

3.0.1.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

13/02 2015

v3.0.0

3.0.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

27/12 2014

v2.9.0

2.9.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

17/12 2014

v2.8.0

2.8.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

02/12 2014

v2.7.0

2.7.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

21/11 2014

v2.6.0

2.6.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

17/11 2014

v2.5.0

2.5.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

16/11 2014

v2.4.0

2.4.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

09/11 2014

v2.3.0

2.3.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

07/11 2014

v2.2.0

2.2.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

29/10 2014

v2.1.0

2.1.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

11/10 2014

v2.0.0

2.0.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

04/09 2014

v1.9.0

1.9.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

21/08 2014

v1.8.0

1.8.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

21/07 2014

v1.7.0

1.7.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

10/07 2014

v1.6.0

1.6.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

10/07 2014

v1.5.0

1.5.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid

28/06 2014

v1.4.0

1.4.0.0 https://github.com/kartik-v/yii2-grid

Yii 2 GridView on steroids. Various enhancements and utilities for the Yii 2.0 GridView widget.

  Sources   Download

BSD 3-Clause

The Requires

 

extension yii2 widget grid