Browse Source

added doc example to gridview column classes

fixes #2276
tags/2.0.0-beta
Carsten Brandt 11 years ago
parent
commit
3bc5dbed82
  1. 12
      framework/grid/ActionColumn.php
  2. 13
      framework/grid/CheckboxColumn.php
  3. 8
      framework/grid/GridView.php
  4. 12
      framework/grid/SerialColumn.php

12
framework/grid/ActionColumn.php

@ -14,6 +14,18 @@ use yii\helpers\Html;
/**
* ActionColumn is a column for the [[GridView]] widget that displays buttons for viewing and manipulating the items.
*
* To add an ActionColumn to the gridview, add it to the [[GridView::columns|columns]] configuration as follows:
*
* ```php
* 'columns' => [
* // ...
* [
* 'class' => 'yii\grid\ActionColumn',
* // you may configure additional properties here
* ],
* ]
* ```
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/

13
framework/grid/CheckboxColumn.php

@ -13,6 +13,19 @@ use yii\helpers\Html;
/**
* CheckboxColumn displays a column of checkboxes in a grid view.
*
* * To add a CheckboxColumn to the [[GridView]], add it to the [[GridView::columns|columns]] configuration as follows:
*
* ```php
* 'columns' => [
* // ...
* [
* 'class' => 'yii\grid\CheckboxColumn',
* // you may configure additional properties here
* ],
* ]
* ```
*
* Users may click on the checkboxes to select rows of the grid. The selected rows may be
* obtained by calling the following JavaScript code:
*

8
framework/grid/GridView.php

@ -67,9 +67,9 @@ class GridView extends BaseListView
* returns an array of the HTML attributes. The anonymous function will be called once for every
* data model returned by [[dataProvider]]. It should have the following signature:
*
* ~~~php
* ```php
* function ($model, $key, $index, $grid)
* ~~~
* ```
*
* - `$model`: the current data model being rendered
* - `$key`: the key value associated with the current data model
@ -111,7 +111,7 @@ class GridView extends BaseListView
* @var array grid column configuration. Each array element represents the configuration
* for one particular grid column. For example,
*
* ~~~php
* ```php
* [
* ['class' => SerialColumn::className()],
* [
@ -122,7 +122,7 @@ class GridView extends BaseListView
* ],
* ['class' => CheckboxColumn::className()],
* ]
* ~~~
* ```
*
* If a column is of class [[DataColumn]], the "class" element can be omitted.
*

12
framework/grid/SerialColumn.php

@ -10,6 +10,18 @@ namespace yii\grid;
/**
* SerialColumn displays a column of row numbers (1-based).
*
* To add a SerialColumn to the [[GridView]], add it to the [[GridView::columns|columns]] configuration as follows:
*
* ```php
* 'columns' => [
* // ...
* [
* 'class' => 'yii\grid\SerialColumn',
* // you may configure additional properties here
* ],
* ]
* ```
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
*/

Loading…
Cancel
Save