Class CButtonColumn
CButtonColumn represents a grid view column that renders one or several buttons.
By default, it will display three buttons, "view", "update" and "delete", which triggers the corresponding actions on the model of the row.
By configuring CButtonColumn::$buttons
and CButtonColumn::$template
properties, the column
can display other buttons and customize the display order of the buttons.
- CComponent
- CGridColumn
- CButtonColumn
Copyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.1
Located at x2engine/framework/zii/widgets/grid/CButtonColumn.php
public
|
|
protected
|
|
protected
|
|
public
string
|
#
getDataCellContent( integer $row )
Returns the data cell content. This method renders the view, update and delete buttons in the data cell. |
protected
|
public
array
|
$htmlOptions | array('class'=>'button-column') |
#
the HTML options for the data cell tags. |
public
array
|
$headerHtmlOptions | array('class'=>'button-column') |
#
the HTML options for the header cell tag. |
public
array
|
$footerHtmlOptions | array('class'=>'button-column') |
#
the HTML options for the footer cell tag. |
public
string
|
$template | '{view} {update} {delete}' |
#
the template that is used to render the content in each data cell. These
default tokens are recognized: {view}, {update} and {delete}. If the |
public
string
|
$viewButtonLabel |
|
#
the label for the view button. Defaults to "View". Note that the label will not be HTML-encoded when rendering. |
public
string
|
$viewButtonImageUrl |
|
#
the image URL for the view button. If not set, an integrated image will be used. You may set this property to be false to render a text link instead. |
public
string
|
$viewButtonUrl | 'Yii::app()->controller->createUrl("view",array("id"=>$data->primaryKey))' |
#
a PHP expression that is evaluated for every view button and whose result is
used as the URL for the view button. In this expression, you can use the
following variables:
CComponent::evaluateExpression() .
A PHP expression can be any PHP code that has a value. To learn more about what an expression is, please refer to the php manual. |
public
array
|
$viewButtonOptions | array('class'=>'view') |
#
the HTML options for the view button tag. |
public
string
|
$updateButtonLabel |
|
#
the label for the update button. Defaults to "Update". Note that the label will not be HTML-encoded when rendering. |
public
string
|
$updateButtonImageUrl |
|
#
the image URL for the update button. If not set, an integrated image will be used. You may set this property to be false to render a text link instead. |
public
string
|
$updateButtonUrl | 'Yii::app()->controller->createUrl("update",array("id"=>$data->primaryKey))' |
#
a PHP expression that is evaluated for every update button and whose result is
used as the URL for the update button. In this expression, you can use the
following variables:
CComponent::evaluateExpression() .
A PHP expression can be any PHP code that has a value. To learn more about what an expression is, please refer to the php manual. |
public
array
|
$updateButtonOptions | array('class'=>'update') |
#
the HTML options for the update button tag. |
public
string
|
$deleteButtonLabel |
|
#
the label for the delete button. Defaults to "Delete". Note that the label will not be HTML-encoded when rendering. |
public
string
|
$deleteButtonImageUrl |
|
#
the image URL for the delete button. If not set, an integrated image will be used. You may set this property to be false to render a text link instead. |
public
string
|
$deleteButtonUrl | 'Yii::app()->controller->createUrl("delete",array("id"=>$data->primaryKey))' |
#
a PHP expression that is evaluated for every delete button and whose result is
used as the URL for the delete button. In this expression, you can use the
following variables:
CComponent::evaluateExpression() .
A PHP expression can be any PHP code that has a value. To learn more about what an expression is, please refer to the php manual. |
public
array
|
$deleteButtonOptions | array('class'=>'delete') |
#
the HTML options for the delete button tag. |
public
string
|
$deleteConfirmation |
|
#
the confirmation message to be displayed when delete button is clicked. By
setting this property to be false, no confirmation message will be displayed.
This property is used only if |
public
string
|
$afterDelete |
|
#
a javascript function that will be invoked after the delete ajax call. This
property is used only if <span
class="php-keyword1">function</span>(<span
class="php-keyword2">link</span>, success, data)
Example: array( class'=>'CButtonColumn', 'afterDelete'=>'function(link,success,data){ if(success) alert("Delete completed successfully"); }', ), |
public
array
|
$buttons | array() |
#
the configuration for buttons. Each array element specifies a single button which has the following format: 'buttonID' => array( 'label'=>'...', // text label of the button 'url'=>'...', // a PHP expression for generating the URL of the button 'imageUrl'=>'...', // image URL of the button. If not set or false, a text link is used 'options'=>array(...), // HTML options for the button tag 'click'=>'...', // a JS function to be invoked when the button is clicked 'visible'=>'...', // a PHP expression for determining whether the button is visible ) In the PHP expression for the 'url' option and/or 'visible' option, the
variable If the 'buttonID' is 'view', 'update' or 'delete' the options will be applied to the default buttons. Note that in order to display non-default buttons, the |
$cssClassExpression,
$filterHtmlOptions,
$footer,
$grid,
$header,
$id,
$visible
|
$filterCellContent,
$footerCellContent,
$hasFooter,
$headerCellContent
|