PHP Class kartik\grid\RadioColumn

To add a RadioColumn to the gridview, add it to the [[GridView::columns|columns]] configuration as follows: php 'columns' => [ ... [ 'class' => RadioColumn::className(), you may configure additional properties here ], ]
Since: 1.0
Author: Kartik Visweswaran ([email protected])
Inheritance: extends yii\grid\Column, use trait ColumnTrait
ファイルを表示 Open project: kartik-v/yii2-grid

Public Properties

Property Type Description
$clearOptions the HTML attributes for the clear button in the header. The following special option is recognized: - label: string, the label for the button (defaults to ×);
$hAlign the horizontal alignment of each column. Should be one of [[GridView::ALIGN_LEFT]], [[GridView::ALIGN_RIGHT]], or [[GridView::ALIGN_CENTER]].
$hidden whether the column is hidden from display. This is different than the visible property, in the sense, that the column is rendered, but hidden from display. This will allow you to still export the column using the export function.
$hiddenFromExport whether the column is hidden in export output. If set to bool true, it will hide the column for all export formats. If set as an array, it will accept the list of GridView export formats and hide output only for them.
$hidePageSummary whether to just hide the page summary display but still calculate the summary based on [[pageSummary]] settings
$mergeHeader whether to merge the header title row and the filter row This will not render the filter for the column and can be used when filter is set to false. Defaults to false. This is only applicable when [[GridView::filterPosition]] for the grid is set to [[GridView::FILTER_POS_BODY]].
$name the name of the radio input fields.
$noWrap whether to force no wrapping on all table cells in the column
$pageSummary the page summary that is displayed above the footer. You can set it to one of the following: - false: the summary will not be displayed. - true: the page summary for the column will be calculated and displayed using the [[pageSummaryFunc]] setting. - string: will be displayed as is. - Closure: you can set it to an anonymous function with the following signature: php example 1 function ($summary, $data, $widget) { return 'Count is ' . $summary; } example 2 function ($summary, $data, $widget) { return 'Range ' . min($data) . ' to ' . max($data); } where: - the $summary variable will be replaced with the calculated summary using the [[pageSummaryFunc]] setting. - the $data variable will contain array of the selected page rows for the column.
$pageSummaryFunc the summary function that will be used to calculate the page summary for the column.
$pageSummaryOptions HTML attributes for the page summary cell. The following special attributes are available: - prepend: _string_, a prefix string that will be prepended before the pageSummary content - append: _string_, a suffix string that will be appended after the pageSummary content
$radioOptions the HTML attributes for radio inputs. This can either be an array of 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 RadioColumn 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 radio, you can use this option in the following way (in this example using the name attribute of the model): php 'radioOptions' => function($model, $key, $index, $column) { return ['value' => $model->name]; }
$rowHighlight highlight current row if checkbox is checked
$rowSelectedClass highlight CSS class to be applied for highlighting the row. Defaults to 'success'.
$showClear whether to show the clear button in the header to clear the radio.
$vAlign the vertical alignment of each column. Should be one of [[GridView::ALIGN_TOP]], [[GridView::ALIGN_BOTTOM]], or [[GridView::ALIGN_MIDDLE]].
$width the width of each column (matches the CSS width property).

Protected Properties

Property Type Description
$_clientScript the internally generated client script to initialize
$_clientVars the variables for the client script
$_columnKey the internally generated column key
$_view the widget view object instance

Public Methods

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

Protected Methods

Method Description
renderDataCellContent ( $model, $key, $index )
renderHeaderCellContent ( )

Method Details

init() public method

public init ( )

renderDataCell() public method

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

renderDataCellContent() protected method

protected renderDataCellContent ( $model, $key, $index )

renderHeaderCellContent() protected method

protected renderHeaderCellContent ( )

Property Details

$_clientScript protected_oe property

the internally generated client script to initialize
protected $_clientScript

$_clientVars protected_oe property

the variables for the client script
protected $_clientVars

$_columnKey protected_oe property

the internally generated column key
protected $_columnKey

$_view protected_oe property

the widget view object instance
protected $_view

$clearOptions public_oe property

the HTML attributes for the clear button in the header. The following special option is recognized: - label: string, the label for the button (defaults to ×);
public $clearOptions

$hAlign public_oe property

the horizontal alignment of each column. Should be one of [[GridView::ALIGN_LEFT]], [[GridView::ALIGN_RIGHT]], or [[GridView::ALIGN_CENTER]].
public $hAlign

$hidden public_oe property

whether the column is hidden from display. This is different than the visible property, in the sense, that the column is rendered, but hidden from display. This will allow you to still export the column using the export function.
public $hidden

$hiddenFromExport public_oe property

whether the column is hidden in export output. If set to bool true, it will hide the column for all export formats. If set as an array, it will accept the list of GridView export formats and hide output only for them.
public $hiddenFromExport

$hidePageSummary public_oe property

whether to just hide the page summary display but still calculate the summary based on [[pageSummary]] settings
public $hidePageSummary

$mergeHeader public_oe property

whether to merge the header title row and the filter row This will not render the filter for the column and can be used when filter is set to false. Defaults to false. This is only applicable when [[GridView::filterPosition]] for the grid is set to [[GridView::FILTER_POS_BODY]].
public $mergeHeader

$name public_oe property

the name of the radio input fields.
public $name

$noWrap public_oe property

whether to force no wrapping on all table cells in the column
See also: http://www.w3schools.com/cssref/pr_text_white-space.asp
public $noWrap

$pageSummary public_oe property

the page summary that is displayed above the footer. You can set it to one of the following: - false: the summary will not be displayed. - true: the page summary for the column will be calculated and displayed using the [[pageSummaryFunc]] setting. - string: will be displayed as is. - Closure: you can set it to an anonymous function with the following signature: php example 1 function ($summary, $data, $widget) { return 'Count is ' . $summary; } example 2 function ($summary, $data, $widget) { return 'Range ' . min($data) . ' to ' . max($data); } where: - the $summary variable will be replaced with the calculated summary using the [[pageSummaryFunc]] setting. - the $data variable will contain array of the selected page rows for the column.
public $pageSummary

$pageSummaryFunc public_oe property

the summary function that will be used to calculate the page summary for the column.
public $pageSummaryFunc

$pageSummaryOptions public_oe property

HTML attributes for the page summary cell. The following special attributes are available: - prepend: _string_, a prefix string that will be prepended before the pageSummary content - append: _string_, a suffix string that will be appended after the pageSummary content
public $pageSummaryOptions

$radioOptions public_oe property

the HTML attributes for radio inputs. This can either be an array of 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 RadioColumn 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 radio, you can use this option in the following way (in this example using the name attribute of the model): php 'radioOptions' => function($model, $key, $index, $column) { return ['value' => $model->name]; }
See also: yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
public $radioOptions

$rowHighlight public_oe property

highlight current row if checkbox is checked
public $rowHighlight

$rowSelectedClass public_oe property

highlight CSS class to be applied for highlighting the row. Defaults to 'success'.
public $rowSelectedClass

$showClear public_oe property

whether to show the clear button in the header to clear the radio.
public $showClear

$vAlign public_oe property

the vertical alignment of each column. Should be one of [[GridView::ALIGN_TOP]], [[GridView::ALIGN_BOTTOM]], or [[GridView::ALIGN_MIDDLE]].
public $vAlign

$width public_oe property

the width of each column (matches the CSS width property).
See also: http://www.w3schools.com/cssref/pr_dim_width.asp
public $width