groupgridview This extension allows to group data in your grid

  1. Links
  2. Requirements
  3. Installation
  4. Usage
  5. Usage with Twitter Bootstrap
  6. Note

GroupGridView extends CGridView with following features:

  • group equal values in merged cells
  • add extra rows for grouped values

Links

Requirements

Developed and tested on Yii 1.1.9.

Installation

Put groupgridview folder from zip to your protected/extensions.

Usage

See code samples in demo.

Main parameters are:

  • mergeColumns - array of columns in which equal cells to be merged
  • mergeType - how merge is displayed:

    • simple: column values are merged independently (default)
    • nested: column values are merged if at least one value of nested columns changes (makes sense when several columns in $mergeColumns option, see #11462)
    • firstrow: column values are merged independently, but value is shown in first row of group and below cells just cleared (instead of rowspan)
  • extraRowColumns - array of columns for which every change of value will trigger extra row
  • extraRowPos - position of extra row relative to group: above (default) | below
  • extraRowExpression - string PHP expression or function that returns value displayed in extrarow. Can use $data and $totals inside.
  • extraRowTotals - function that is used to calc subtotals. Example:
'extraRowTotals' => function($data, $row, &$totals) {
     if(!isset($totals['sum_age'])) $totals['sum_age'] = 0;
     $totals['sum_age'] += $data['age'];
}

Variable $totals is available in extraRowExpression.
Please consider that subtotals are incorrect when used together with pagination!

Usage with Twitter Bootstrap

You can use it with bootstrap gridview via ext.groupgridview.BootGroupGridView widget.
Since 1.2 you need Yii-bootstrap 1.0 and above.

Note

Extension uses only data that are on current grid page. You should take care about sorting to get correct results.

73 0
86 followers
6 734 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: User Interface
Developed by: Vitalets
Created on: Apr 1, 2012
Last updated: 10 years ago

Downloads

show all

Related Extensions