PHP Class kartik\grid\ExpandRowColumn

To add an ExpandRowColumn to the gridview, add it to the [[GridView::columns|columns]] configuration as follows: php 'columns' => [ ... [ 'class' => ExpandRowColumn::className(), you may configure additional properties here ], ]
Since: 1.0
Author: Kartik Visweswaran ([email protected])
Inheritance: extends DataColumn
Datei anzeigen Open project: kartik-v/yii2-grid

Public Properties

Property Type Description
$allowBatchToggle allow batch expansion or batch collapse of all rows by clicking the header indicator. Defaults to true.
$collapseAllTitle title to display on hover of collapse indicator at header.
$collapseIcon icon for the collapse indicator. If this is not set, it will derive values automatically using the following rules: - If GridView bootstrap property is set to true, it will default to [[GridView::ICON_COLLAPSE]] or - If GridView bootstrap property is set to false, then it will default to -.
$collapseTitle title to display on hover of collapse indicator for each row.
$defaultHeaderState default state of the header. The following values can be set: - [[GridView::ROW_COLLAPSED]]: Will set all rows to collapsed and display the [[expandIcon]]. - [[GridView::ROW_EXPANDED]]: Will set all rows to expanded and display the [[collapseIcon]].
$detail the detail content (html markup) to be displayed in the expanded row. Either [[detail]] or [[detailUrl]] must be entered. This can be a normal html markup or an anonymous function that returns the markup. The anonymous function should have the signature: function ($model, $key, $index, $column), where: - $model: _\yii\base\Model_, is the data model. - $key: _string|object_, is the primary key value associated with the data model. - $index: _integer_, is the zero-based index of the data model among the model array returned by [[dataProvider]]. - $column: _ExpandRowColumn_, is the column object instance.
$detailAnimationDuration the animation duration to slide up/down the detail row.
$detailOptions the HTML attributes for the expanded table row. This can be an array or an anonymous function of the signature: function ($model, $key, $index, $column), where: - $model: _\yii\base\Model_, is the data model. - $key: _string|object_, is the primary key value associated with the data model. - $index: _integer_, is the zero-based index of the data model among the model array returned by [[dataProvider]]. - $column: _ExpandRowColumn_, is the column object instance.
$detailRowCssClass the CSS class for the detail content table row.
$detailUrl the url/action that would render the detail content via ajax. Either detail OR detailUrl must be entered. The ajax response must return the content/markup to render. The extension automatically passes the following data parameters to the server URL as POST data: - expandRowKey the key associated with the data model - expandRowIndex the zero-based index of the data model among the models array returned by [[GridView::dataProvider]].
$disabled whether the expand icon indicator is disabled. Defaults to false. If set to true, one cannot collapse or expand the sections. This can be setup as an anonymous function having the signature: function ($model, $key, $index, $column), where: - $model: _\yii\base\Model_, is the data model. - $key: _string|object_, is the primary key value associated with the data model. - $index: _integer_, is the zero-based index of the data model among the model array returned by [[dataProvider]]. - $column: _ExpandRowColumn_, is the column object instance.
$enableCache whether to enable caching of expanded row content while expanding the row using ajax triggered action (applicable when detailUrl is set). Defaults to true.
$enableRowClick whether to toggle the expansion/collapse by clicking on the table row. To disable row click for specific elements within the row you can add the CSS class kv-disable-click to tags/elements to disable the toggle functionality.
$expandAllTitle title to display on hover of expand indicator at header.
$expandIcon icon for the expand indicator. If this is not set, it will derive values automatically using the following rules: - If GridView bootstrap property is set to true, it will default to [[GridView::ICON_EXPAND]] or - If GridView bootstrap property is set to false, then it will default to +.
$expandOneOnly whether to allow only one row to be expanded at a time and auto collapse other expanded rows whenever a row is expanded. Defaults to false.
$expandTitle title to display on hover of expand indicator for each row.
$extraData additional data that will be passed to the ajax load function as key value pairs
$hAlign
$hiddenFromExport
$mergeHeader
$onDetailLoaded the javascript callback to execute after loading the content via ajax. Only applicable when detailUrl is provided.
$rowClickExcludedTags list of tags in the row on which row click will be disabled.
$value the value of this attribute will identify the state of the current row. The following values are supported: - [[GridView::ROW_EXPANDED]] or 0: the row will be expanded by default and will display the collapse indicator. - [[GridView::ROW_COLLAPSED]] or 1: the row will be collapsed by default and will display the expand indicator. - [[GridView::ROW_NONE]] or -1: no indicator will be displayed for the row. If this is not set, $model[$attribute] will be used to obtain the value. If this value is evaluated as empty or null, it is treated as [[GridView::ROW_NONE]]. This can also be an anonymous function that returns one of the values above. The anonymous function should have the signature function ($model, $key, $index, $column), where: - $model: _\yii\base\Model_, is the data model. - $key: _string|object_, is the primary key value associated with the data model. - $index: _integer_, is the zero-based index of the data model among the model array returned by [[dataProvider]]. - $column: _ExpandRowColumn_, is the column object instance.
$width

Protected Properties

Property Type Description
$_hashVar hashed javascript variable to store grid expand row options

Public Methods

Method Description
getDataCellValue ( $model, $key, $index )
init ( )
renderDataCell ( $model, $key, $index )

Protected Methods

Method Description
getIcon ( string $type ) : string Get icon indicator
parseData ( string | Closur\Closure $data, Model $model, string | object $key, integer $index, ExpandRowColumn $column ) : string Parses data for Closure and returns accordingly
renderHeaderCellContent ( )
setProp ( string $prop, string $val ) Sets property for the object instance if not set

Method Details

getDataCellValue() public method

public getDataCellValue ( $model, $key, $index )

getIcon() protected method

Get icon indicator
protected getIcon ( string $type ) : string
$type string one of `expand` or `collapse`
return string the icon indicator markup

init() public method

public init ( )

parseData() protected static method

Parses data for Closure and returns accordingly
protected static parseData ( string | Closur\Closure $data, Model $model, string | object $key, integer $index, ExpandRowColumn $column ) : string
$data string | Closur\Closure the data to parse.
$model yii\base\Model the data model.
$key string | object the key associated with the data model.
$index integer the zero-based index of the data model among the models array returned by [[GridView::dataProvider]].
$column ExpandRowColumn the column object instance.
return string

renderDataCell() public method

public renderDataCell ( $model, $key, $index )

renderHeaderCellContent() protected method

protected renderHeaderCellContent ( )

setProp() protected method

Sets property for the object instance if not set
protected setProp ( string $prop, string $val )
$prop string the property name
$val string the property value

Property Details

$_hashVar protected_oe property

hashed javascript variable to store grid expand row options
protected $_hashVar

$allowBatchToggle public_oe property

allow batch expansion or batch collapse of all rows by clicking the header indicator. Defaults to true.
public $allowBatchToggle

$collapseAllTitle public_oe property

title to display on hover of collapse indicator at header.
public $collapseAllTitle

$collapseIcon public_oe property

icon for the collapse indicator. If this is not set, it will derive values automatically using the following rules: - If GridView bootstrap property is set to true, it will default to [[GridView::ICON_COLLAPSE]] or - If GridView bootstrap property is set to false, then it will default to -.
public $collapseIcon

$collapseTitle public_oe property

title to display on hover of collapse indicator for each row.
public $collapseTitle

$defaultHeaderState public_oe property

default state of the header. The following values can be set: - [[GridView::ROW_COLLAPSED]]: Will set all rows to collapsed and display the [[expandIcon]]. - [[GridView::ROW_EXPANDED]]: Will set all rows to expanded and display the [[collapseIcon]].
public $defaultHeaderState

$detail public_oe property

the detail content (html markup) to be displayed in the expanded row. Either [[detail]] or [[detailUrl]] must be entered. This can be a normal html markup or an anonymous function that returns the markup. The anonymous function should have the signature: function ($model, $key, $index, $column), where: - $model: _\yii\base\Model_, is the data model. - $key: _string|object_, is the primary key value associated with the data model. - $index: _integer_, is the zero-based index of the data model among the model array returned by [[dataProvider]]. - $column: _ExpandRowColumn_, is the column object instance.
public $detail

$detailAnimationDuration public_oe property

the animation duration to slide up/down the detail row.
See also: http://api.jquery.com/slidedown/
public $detailAnimationDuration

$detailOptions public_oe property

the HTML attributes for the expanded table row. This can be an array or an anonymous function of the signature: function ($model, $key, $index, $column), where: - $model: _\yii\base\Model_, is the data model. - $key: _string|object_, is the primary key value associated with the data model. - $index: _integer_, is the zero-based index of the data model among the model array returned by [[dataProvider]]. - $column: _ExpandRowColumn_, is the column object instance.
public $detailOptions

$detailRowCssClass public_oe property

the CSS class for the detail content table row.
public $detailRowCssClass

$detailUrl public_oe property

the url/action that would render the detail content via ajax. Either detail OR detailUrl must be entered. The ajax response must return the content/markup to render. The extension automatically passes the following data parameters to the server URL as POST data: - expandRowKey the key associated with the data model - expandRowIndex the zero-based index of the data model among the models array returned by [[GridView::dataProvider]].
See also: http://api.jquery.com/jquery.load/
public $detailUrl

$disabled public_oe property

whether the expand icon indicator is disabled. Defaults to false. If set to true, one cannot collapse or expand the sections. This can be setup as an anonymous function having the signature: function ($model, $key, $index, $column), where: - $model: _\yii\base\Model_, is the data model. - $key: _string|object_, is the primary key value associated with the data model. - $index: _integer_, is the zero-based index of the data model among the model array returned by [[dataProvider]]. - $column: _ExpandRowColumn_, is the column object instance.
public $disabled

$enableCache public_oe property

whether to enable caching of expanded row content while expanding the row using ajax triggered action (applicable when detailUrl is set). Defaults to true.
public $enableCache

$enableRowClick public_oe property

whether to toggle the expansion/collapse by clicking on the table row. To disable row click for specific elements within the row you can add the CSS class kv-disable-click to tags/elements to disable the toggle functionality.
public $enableRowClick

$expandAllTitle public_oe property

title to display on hover of expand indicator at header.
public $expandAllTitle

$expandIcon public_oe property

icon for the expand indicator. If this is not set, it will derive values automatically using the following rules: - If GridView bootstrap property is set to true, it will default to [[GridView::ICON_EXPAND]] or - If GridView bootstrap property is set to false, then it will default to +.
public $expandIcon

$expandOneOnly public_oe property

whether to allow only one row to be expanded at a time and auto collapse other expanded rows whenever a row is expanded. Defaults to false.
public $expandOneOnly

$expandTitle public_oe property

title to display on hover of expand indicator for each row.
public $expandTitle

$extraData public_oe property

additional data that will be passed to the ajax load function as key value pairs
public $extraData

$hAlign public_oe property

public $hAlign

$hiddenFromExport public_oe property

public $hiddenFromExport

$mergeHeader public_oe property

public $mergeHeader

$onDetailLoaded public_oe property

the javascript callback to execute after loading the content via ajax. Only applicable when detailUrl is provided.
public $onDetailLoaded

$rowClickExcludedTags public_oe property

list of tags in the row on which row click will be disabled.
public $rowClickExcludedTags

$value public_oe property

the value of this attribute will identify the state of the current row. The following values are supported: - [[GridView::ROW_EXPANDED]] or 0: the row will be expanded by default and will display the collapse indicator. - [[GridView::ROW_COLLAPSED]] or 1: the row will be collapsed by default and will display the expand indicator. - [[GridView::ROW_NONE]] or -1: no indicator will be displayed for the row. If this is not set, $model[$attribute] will be used to obtain the value. If this value is evaluated as empty or null, it is treated as [[GridView::ROW_NONE]]. This can also be an anonymous function that returns one of the values above. The anonymous function should have the signature function ($model, $key, $index, $column), where: - $model: _\yii\base\Model_, is the data model. - $key: _string|object_, is the primary key value associated with the data model. - $index: _integer_, is the zero-based index of the data model among the model array returned by [[dataProvider]]. - $column: _ExpandRowColumn_, is the column object instance.
public $value

$width public_oe property

public $width