Commit 3bc5dbed by Carsten Brandt

added doc example to gridview column classes

fixes #2276
parent a90f2f21
...@@ -14,6 +14,18 @@ use yii\helpers\Html; ...@@ -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. * 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> * @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0 * @since 2.0
*/ */
......
...@@ -13,6 +13,19 @@ use yii\helpers\Html; ...@@ -13,6 +13,19 @@ use yii\helpers\Html;
/** /**
* CheckboxColumn displays a column of checkboxes in a grid view. * 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 * Users may click on the checkboxes to select rows of the grid. The selected rows may be
* obtained by calling the following JavaScript code: * obtained by calling the following JavaScript code:
* *
......
...@@ -67,9 +67,9 @@ class GridView extends BaseListView ...@@ -67,9 +67,9 @@ class GridView extends BaseListView
* returns an array of the HTML attributes. The anonymous function will be called once for every * 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: * data model returned by [[dataProvider]]. It should have the following signature:
* *
* ~~~php * ```php
* function ($model, $key, $index, $grid) * function ($model, $key, $index, $grid)
* ~~~ * ```
* *
* - `$model`: the current data model being rendered * - `$model`: the current data model being rendered
* - `$key`: the key value associated with the current data model * - `$key`: the key value associated with the current data model
...@@ -111,7 +111,7 @@ class GridView extends BaseListView ...@@ -111,7 +111,7 @@ class GridView extends BaseListView
* @var array grid column configuration. Each array element represents the configuration * @var array grid column configuration. Each array element represents the configuration
* for one particular grid column. For example, * for one particular grid column. For example,
* *
* ~~~php * ```php
* [ * [
* ['class' => SerialColumn::className()], * ['class' => SerialColumn::className()],
* [ * [
...@@ -122,7 +122,7 @@ class GridView extends BaseListView ...@@ -122,7 +122,7 @@ class GridView extends BaseListView
* ], * ],
* ['class' => CheckboxColumn::className()], * ['class' => CheckboxColumn::className()],
* ] * ]
* ~~~ * ```
* *
* If a column is of class [[DataColumn]], the "class" element can be omitted. * If a column is of class [[DataColumn]], the "class" element can be omitted.
* *
......
...@@ -10,6 +10,18 @@ namespace yii\grid; ...@@ -10,6 +10,18 @@ namespace yii\grid;
/** /**
* SerialColumn displays a column of row numbers (1-based). * 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> * @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0 * @since 2.0
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment