Skip to content

Commit

Permalink
Fix #54: Upgrade to release v1.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Jul 10, 2014
1 parent c192b44 commit ec1b1fb
Show file tree
Hide file tree
Showing 20 changed files with 163 additions and 63 deletions.
35 changes: 29 additions & 6 deletions CHANGE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,30 @@
Version 1.6.0
=============

**Date:** 10-Jul-2014

1. (enh #54): Grid Export Enhancements
- Ability to preprocess and convert column data to your desired value before exporting. For example convert the HTML formatted icons for BooleanColumn to user friendly text like `Active` or `Inactive` after export.
- Hide any row or column in the grid by adding one or more of the following CSS classes:
- `skip-export`: Will skip this element during export for all formats (`html`, `csv`, `txt`, `xls`).
- `skip-export-html`: Will skip this element during export for `html` export format.
- `skip-export-csv`: Will skip this element during export for `csv` export format.
- `skip-export-txt`: Will skip this element during export for `txt` export format.
- `skip-export-xls`: Will skip this element during export for `xls` (excel) export format.
These CSS can be set virtually anywhere. For example `headerOptions`, `contentOptions`, `beforeHeader` etc.

2. (enh #52): Upgraded float header plugin

3. Enhanced panel footer to have a consistent height whether pagination is displayed or not.

4. `BooleanColumn` icons have been setup as `ICON_ACTIVE` and `ICON_INACTIVE` constants in GridView.

5. `ActionColumn` content by default has been disabled to appear in export output. The `skip-export` CSS class has been set as default in `headerOptions` and `contentOptions`.

Version 1.5.0
=============

Date: 04-Jul-2014
**Date:** 04-Jul-2014

1. (enh #51): Enhanced GridView header and footer, to include additional headers/footers before or after default header/footer.
The properties below can be set as an array or string:
Expand All @@ -14,7 +37,7 @@ Date: 04-Jul-2014
Version 1.4.0
=============

Date: 29-Apr-2014
**Date:** 29-Apr-2014

1. (enh #25): Allow highlighting of selected row for a CheckboxColumn
- Added `rowHighlight` property to set if a row needs to be highlighted
Expand All @@ -24,7 +47,7 @@ Date: 29-Apr-2014
Version 1.3.0
=============

Date: 18-Apr-2014
**Date:** 18-Apr-2014

1. (enh #19): Gridview enhancements (export, toolbar, iframe)
- Enable rendering of export without panel by passing `{export}` variable to grid `layout` property.
Expand All @@ -35,7 +58,7 @@ Date: 18-Apr-2014
Version 1.2.0
=============

Date: 22-Mar-2014
**Date:** 22-Mar-2014

1. Converted the extension into a module.
2. Export features enhanced for use across all browsers:
Expand All @@ -47,7 +70,7 @@ Date: 22-Mar-2014
Version 1.1.0
=============

Date: 15-Mar-2014
**Date:** 15-Mar-2014

1. Export features added through a brand new custom JQuery plugin:
- Save displayed grid as HTML
Expand All @@ -58,6 +81,6 @@ Date: 15-Mar-2014
Version 1.0.0
=============

Date: 10-Mar-2014
**Date:** 10-Mar-2014

Initial release
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Yii2 GridView on steroids. A module with various modifications and enhancements
Refer [detailed documentation](http://demos.krajee.com/grid) and/or a [complete demo](http://demos.krajee.com/grid-demo).

## Latest Release
The latest version of the module is v1.5.0 released on 04-Jul-2014. With this release, the GridView now offers you to add customized header and footer rows
The latest version of the module is v1.6.0 released on 10-Jul-2014. With this release, the GridView now offers you to add customized header and footer rows
above/below the default header. Refer the [CHANGE LOG](https://github.com/kartik-v/yii2-grid/blob/master/CHANGE.md) for details.

> NOTE: This extension depends on the [kartik-v/yii2-widgets](https://github.com/kartik-v/yii2-widgets) extension which in turn depends on the
Expand Down Expand Up @@ -51,7 +51,17 @@ summary/totals for the current GridView page. The following parameters are appli

### Export Grid Data (New)
This is a new feature added to the GridView widget. It allows you to export the displayed grid content as HTML, CSV, TEXT, or EXCEL. It uses the rendered grid data on client to convert to one of the format specified using JQuery.
This is supported across all browsers.
This is supported across all browsers. The following are new features added since release v1.6.0:

- Ability to preprocess and convert column data to your desired value before exporting. There is a new property `exportConversions` that can be setup in GridView.
For example, this currently is set as a default to convert the HTML formatted icons for BooleanColumn to user friendly text like `Active` or `Inactive` after export.
- Hide any row or column in the grid by adding one or more of the following CSS classes:
- `skip-export`: Will skip this element during export for all formats (`html`, `csv`, `txt`, `xls`).
- `skip-export-html`: Will skip this element during export for `html` export format.
- `skip-export-csv`: Will skip this element during export for `csv` export format.
- `skip-export-txt`: Will skip this element during export for `txt` export format.
- `skip-export-xls`: Will skip this element during export for `xls` (excel) export format.
These CSS can be set virtually anywhere. For example `headerOptions`, `contentOptions`, `beforeHeader` etc.

## Data Column (Enhanced)
### \kartik\grid\DataColumn
Expand All @@ -66,11 +76,15 @@ within another formula column. Refer [documentation](http://demos.krajee.com/gri
## Boolean Column (New)
### \kartik\grid\BooleanColumn
This is a new grid column class that extends the \kartik\grid\DataColumn class. It automatically converts boolean data (true/false) values to user friendly indicators or labels (that are configurable).
Refer [documentation](http://demos.krajee.com/grid#boolean-column) for details.
Refer [documentation](http://demos.krajee.com/grid#boolean-column) for details. The following are new features added since release v1.6.0:

- `BooleanColumn` icons have been setup as `ICON_ACTIVE` and `ICON_INACTIVE` constants in GridView.

## Action Column (Enhanced)
### \kartik\grid\ActionColumn
Enhancements of `\yii\grid\ActionColumn` to include optional dropdown Action menu and work with the new pageSummary and a default styling to work for many scenarios. Refer [documentation](http://demos.krajee.com/grid#action-column) for details.
The following are new features added since release v1.6.0:
- `ActionColumn` content by default has been disabled to appear in export output. The `skip-export` CSS class has been set as default in `headerOptions` and `contentOptions`.

## Serial Column (Enhanced)
### \kartik\grid\SerialColumn
Expand Down
20 changes: 18 additions & 2 deletions grid/ActionColumn.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*/

namespace kartik\grid;
Expand Down Expand Up @@ -116,6 +116,22 @@ class ActionColumn extends \yii\grid\ActionColumn
*/
public $mergeHeader = true;

/**
* @var array the HTML attributes for the header cell tag.
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
*/
public $headerOptions = ['class'=>'skip-export'];

/**
* @var array|\Closure the HTML attributes for the data cell tag. This can either be an array of
* attributes or an anonymous function ([[Closure]]) that returns such an array.
* The signature of the function should be the following: `function ($model, $key, $index, $column)`.
* A function may be used to assign different attributes to different rows based on the data in that row.
*
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
*/
public $contentOptions = ['class'=>'skip-export'];

/**
* @var bool is the dropdown menu to be rendered?
*/
Expand Down
12 changes: 6 additions & 6 deletions grid/BooleanColumn.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*/

namespace kartik\grid;
Expand Down Expand Up @@ -61,14 +61,14 @@ class BooleanColumn extends DataColumn

/**
* @var string icon/indicator for the true value. If this is not set, it will use the value from `trueLabel`.
* If GridView `bootstrap` property is set to true - it will default to
* If GridView `bootstrap` property is set to true - it will default to [[GridView::ICON_ACTIVE]]
* `<span class="glyphicon glyphicon-ok text-success"></span>`
*/
public $trueIcon;

/**
* @var string icon/indicator for the false value. If this is null, it will use the value from `falseLabel`.
* If GridView `bootstrap` property is set to true - it will default to
* If GridView `bootstrap` property is set to true - it will default to [[GridView::ICON_INACTIVE]]
* `<span class="glyphicon glyphicon-remove text-danger"></span>`
*/
public $falseIcon;
Expand All @@ -89,11 +89,11 @@ public function init()
$this->filter = [true => $this->trueLabel, false => $this->falseLabel];

if (empty($this->trueIcon)) {
$this->trueIcon = ($this->grid->bootstrap) ? '<span class="glyphicon glyphicon-ok text-success"></span>' : $this->trueLabel;
$this->trueIcon = ($this->grid->bootstrap) ? GridView::ICON_ACTIVE : $this->trueLabel;
}

if (empty($this->falseIcon)) {
$this->falseIcon = ($this->grid->bootstrap) ? '<span class="glyphicon glyphicon-remove text-danger"></span>' : $this->falseIcon;
$this->falseIcon = ($this->grid->bootstrap) ? GridView::ICON_INACTIVE : $this->falseIcon;
}

parent::init();
Expand Down
4 changes: 2 additions & 2 deletions grid/CheckboxColumn.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*/

namespace kartik\grid;
Expand Down
4 changes: 2 additions & 2 deletions grid/DataColumn.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*/

namespace kartik\grid;
Expand Down
4 changes: 2 additions & 2 deletions grid/FormulaColumn.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*/

namespace kartik\grid;
Expand Down
4 changes: 2 additions & 2 deletions grid/GridExportAsset.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*/

namespace kartik\grid;
Expand Down
4 changes: 2 additions & 2 deletions grid/GridFloatHeadAsset.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*/

namespace kartik\grid;
Expand Down
36 changes: 32 additions & 4 deletions grid/GridView.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*/

namespace kartik\grid;
Expand Down Expand Up @@ -40,6 +40,12 @@ class GridView extends \yii\grid\GridView
const TYPE_SUCCESS = 'success';
const TYPE_ACTIVE = 'active'; // only applicable for table row contextual style

/**
* Boolean Icons
*/
const ICON_ACTIVE = '<span class="glyphicon glyphicon-ok text-success"></span>';
const ICON_INACTIVE = '<span class="glyphicon glyphicon-remove text-danger"></span>';

/**
* Alignment
*/
Expand Down Expand Up @@ -347,13 +353,34 @@ class GridView extends \yii\grid\GridView
* - options: array, HTML attributes for the export format menu item.
*/
public $exportConfig = [];


/**
* @var array, conversion of defined patterns in the grid cells as a preprocessing before
* the gridview is formatted for export. Each array row must consist of the following
* two keys:
* - `from`: string, is the pattern to search for in each grid column's cells
* - `to`: string, is the string to replace the pattern in the grid column cells
* This defaults to
* ```
* [
* ['from'=>GridView::ICON_ACTIVE, 'to'=>Yii::t('kvgrid', 'Active')],
* ['from'=>GridView::ICON_INACTIVE, 'to'=>Yii::t('kvgrid', 'Inactive')]
* ]
* ```
*/
public $exportConversions = [];

public function init()
{
$module = Yii::$app->getModule('gridview');
if ($module == null || !$module instanceof \kartik\grid\Module) {
throw new InvalidConfigException('The "gridview" module MUST be setup in your Yii configuration file and assigned to "\kartik\grid\Module" class.');
}
$this->exportConversions = ArrayHelper::merge([
['from'=>self::ICON_ACTIVE, 'to'=>Yii::t('kvgrid', 'Active')],
['from'=>self::ICON_INACTIVE, 'to'=>Yii::t('kvgrid', 'Inactive')]
], $this->exportConversions);

if ($this->export !== false) {
$this->export = ArrayHelper::merge([
'label' => Yii::t('kvgrid', 'Export'),
Expand Down Expand Up @@ -646,7 +673,8 @@ protected function registerAssets()
'rowDelimiter' => ArrayHelper::getValue($setting, 'rowDelimiter', ''),
'alertMsg' => ArrayHelper::getValue($setting, 'alertMsg', false),
'browserPopupsMsg' => $popup,
'cssFile' => ArrayHelper::getValue($setting, 'cssFile', '')
'cssFile' => ArrayHelper::getValue($setting, 'cssFile', ''),
'exportConversions' => $this->exportConversions
];
$view->registerJs($id . '.gridexport(' . Json::encode($options) . ');');
}
Expand Down
4 changes: 2 additions & 2 deletions grid/GridViewAsset.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*/

namespace kartik\grid;
Expand Down
4 changes: 2 additions & 2 deletions grid/Module.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*/

namespace kartik\grid;
Expand Down
4 changes: 2 additions & 2 deletions grid/SerialColumn.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

/**
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*/

namespace kartik\grid;
Expand Down
6 changes: 3 additions & 3 deletions grid/assets/css/kv-grid.css
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*
* Gridview widget styling and enhancements for Bootstrap.
* Built for Yii Framework 2.0
* Author: Kartik Visweswaran
* Year: 2013
* Year: 2014
* For more Yii related demos visit http://demos.krajee.com
*/
.kv-panel-pager {
Expand Down
6 changes: 3 additions & 3 deletions grid/assets/css/kv-grid.min.css
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*!
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2013
* @copyright Copyright &copy; Kartik Visweswaran, Krajee.com, 2014
* @package yii2-grid
* @version 1.0.0
* @version 1.6.0
*
* Gridview widget styling and enhancements for Bootstrap.
* Built for Yii Framework 2.0
* Author: Kartik Visweswaran
* Year: 2013
* Year: 2014
* For more Yii related demos visit http://demos.krajee.com
*/.kv-panel-pager{min-height: 34px}.kv-panel-pager .pagination{margin:0 0 -5px 0;padding:0}.kv-panel-before{padding:10px;border-bottom:1px solid #ddd}.kv-panel-after{padding:10px;border-top:1px solid #ddd}.kv-table-float{border-top:none;border-bottom:none;background-color:#fff}.kv-align-center{text-align:center}.kv-align-left{text-align:left}.kv-align-right{text-align:right}.kv-align-top{vertical-align:top!important}.kv-align-bottom{vertical-align:bottom!important}.kv-align-middle{vertical-align:middle!important}.kv-nowrap {white-space: nowrap}.kv-merged-header{border-bottom:2px solid #ddd!important}.kv-page-summary,.kv-table-footer{border-top:4px double #ddd;font-weight:700}.kv-table-caption{font-size:1.5em;padding:8px;border:1px solid #ddd;border-bottom:none}.panel .kv-table-caption{border:none;border-bottom:1px solid #ddd}
Loading

0 comments on commit ec1b1fb

Please sign in to comment.