Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
eeb4e29d
Commit
eeb4e29d
authored
Dec 17, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve gridview phpdoc
parent
b6be7111
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
5 deletions
+30
-5
CheckboxColumn.php
framework/grid/CheckboxColumn.php
+15
-2
Column.php
framework/grid/Column.php
+4
-0
DataColumn.php
framework/grid/DataColumn.php
+8
-3
SerialColumn.php
framework/grid/SerialColumn.php
+3
-0
No files found.
framework/grid/CheckboxColumn.php
View file @
eeb4e29d
...
@@ -29,10 +29,10 @@ use yii\helpers\Html;
...
@@ -29,10 +29,10 @@ use yii\helpers\Html;
* 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:
*
*
*
~~~
*
```javascript
* var keys = $('#grid').yiiGridView('getSelectedRows');
* var keys = $('#grid').yiiGridView('getSelectedRows');
* // keys is an array consisting of the keys associated with the selected rows
* // keys is an array consisting of the keys associated with the selected rows
*
~~~
*
```
*
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @author Qiang Xue <qiang.xue@gmail.com>
* @since 2.0
* @since 2.0
...
@@ -46,6 +46,19 @@ class CheckboxColumn extends Column
...
@@ -46,6 +46,19 @@ class CheckboxColumn extends Column
/**
/**
* @var array|\Closure the HTML attributes for checkboxes. This can either be an array of
* @var array|\Closure the HTML attributes for checkboxes. This can either be an array of
* attributes or an anonymous function ([[Closure]]) that returns such an array.
* 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)`.
* Where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered
* and `$column` is a reference to the [[CheckboxColumn]] object.
* A function may be used to assign different attributes to different rows based on the data in that row.
* Specifically if you want to set a different value for the checkbox
* you can use this option in the following way (in this example using the `name` attribute of the model):
*
* ```php
* 'checkboxOptions' => function($model, $key, $index, $column) {
* return ['value' => $model->name];
* }
* ```
*
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
*/
*/
public
$checkboxOptions
=
[];
public
$checkboxOptions
=
[];
...
...
framework/grid/Column.php
View file @
eeb4e29d
...
@@ -34,6 +34,8 @@ class Column extends Object
...
@@ -34,6 +34,8 @@ class Column extends Object
/**
/**
* @var callable This is a callable that will be used to generated the content of each cell.
* @var callable This is a callable that will be used to generated the content of each cell.
* The signature of the function should be the following: `function ($model, $key, $index, $column)`.
* The signature of the function should be the following: `function ($model, $key, $index, $column)`.
* Where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered
* and `$column` is a reference to the [[Column]] object.
*/
*/
public
$content
;
public
$content
;
/**
/**
...
@@ -54,6 +56,8 @@ class Column extends Object
...
@@ -54,6 +56,8 @@ class Column extends Object
* @var array|\Closure the HTML attributes for the data cell tag. This can either be an array of
* @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.
* 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)`.
* The signature of the function should be the following: `function ($model, $key, $index, $column)`.
* Where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered
* and `$column` is a reference to the [[Column]] object.
* A function may be used to assign different attributes to different rows based on the data in that row.
* 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.
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
...
...
framework/grid/DataColumn.php
View file @
eeb4e29d
...
@@ -56,13 +56,18 @@ class DataColumn extends Column
...
@@ -56,13 +56,18 @@ class DataColumn extends Column
*/
*/
public
$encodeLabel
=
true
;
public
$encodeLabel
=
true
;
/**
/**
* @var string|\Closure an anonymous function that returns the value to be displayed for every data model.
* @var string|\Closure an anonymous function or a string that is used to determine the value to display in the current column.
* The signature of this function is `function ($model, $key, $index, $column)`.
*
* If this is not set, `$model[$attribute]` will be used to obtain the value.
* If this is an anonymous function, it will be called for each row and the return value will be used as the value to
* display for every data model. The signature of this function should be: `function ($model, $key, $index, $column)`.
* Where `$model`, `$key`, and `$index` refer to the model, key and index of the row currently being rendered
* and `$column` is a reference to the [[DataColumn]] object.
*
*
* You may also set this property to a string representing the attribute name to be displayed in this column.
* You may also set this property to a string representing the attribute name to be displayed in this column.
* This can be used when the attribute to be displayed is different from the [[attribute]] that is used for
* This can be used when the attribute to be displayed is different from the [[attribute]] that is used for
* sorting and filtering.
* sorting and filtering.
*
* If this is not set, `$model[$attribute]` will be used to obtain the value, where `$attribute` is the value of [[attribute]].
*/
*/
public
$value
;
public
$value
;
/**
/**
...
...
framework/grid/SerialColumn.php
View file @
eeb4e29d
...
@@ -27,6 +27,9 @@ namespace yii\grid;
...
@@ -27,6 +27,9 @@ namespace yii\grid;
*/
*/
class
SerialColumn
extends
Column
class
SerialColumn
extends
Column
{
{
/**
* @inheritdoc
*/
public
$header
=
'#'
;
public
$header
=
'#'
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment