CCheckBoxColumn

Package zii.widgets.grid
Inheritance class CCheckBoxColumn » CGridColumn » CComponent
Since 1.1
Version $Id: CCheckBoxColumn.php 183 2010-06-07 01:44:43Z qiang.xue $
CCheckBoxColumn represents a grid view column of checkboxes.

CCheckBoxColumn supports single selection and multiple selection. The mode is determined according to CGridView::selectableRows. When in multiple selection mode, the header cell will display an additional checkbox, clicking on which will check or uncheck all of the checkboxes in the data cells.

By default, the checkboxes rendered in data cells will have the values that are the same as the key values of the data model. One may change this by setting either name or value.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
checkBoxHtmlOptions array the HTML options for the checkboxes. CCheckBoxColumn
cssClassExpression string a PHP expression that is evaluated for every data cell and whose result is used as the CSS class name for the data cell. CGridColumn
footerHtmlOptions array the HTML options for the footer cell tag. CGridColumn
grid CGridView the grid view object that owns this column. CGridColumn
hasFooter boolean whether this column has a footer cell. CGridColumn
headerHtmlOptions array the HTML options for the header cell tag. CGridColumn
htmlOptions array the HTML options for the data cell tags. CGridColumn
id string the ID of this column. CGridColumn
name string the attribute name of the data model. CCheckBoxColumn
value string a PHP expression that will be evaluated for every data cell and whose result will be rendered in each data cell as the checkbox value. CCheckBoxColumn
visible boolean whether this column is visible. CGridColumn

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__call() Calls the named method which is not a class method. CComponent
__construct() Constructor. CGridColumn
__get() Returns a property value, an event handler list or a behavior based on its name. CComponent
__isset() Checks if a property value is null. CComponent
__set() Sets value of a component property. CComponent
__unset() Sets a component property to be null. CComponent
asa() Returns the named behavior object. CComponent
attachBehavior() Attaches a behavior to this component. CComponent
attachBehaviors() Attaches a list of behaviors to the component. CComponent
attachEventHandler() Attaches an event handler to an event. CComponent
canGetProperty() Determines whether a property can be read. CComponent
canSetProperty() Determines whether a property can be set. CComponent
detachBehavior() Detaches a behavior from the component. CComponent
detachBehaviors() Detaches all behaviors from the component. CComponent
detachEventHandler() Detaches an existing event handler. CComponent
disableBehavior() Disables an attached behavior. CComponent
disableBehaviors() Disables all behaviors attached to this component. CComponent
enableBehavior() Enables an attached behavior. CComponent
enableBehaviors() Enables all behaviors attached to this component. CComponent
evaluateExpression() Evaluates a PHP expression or callback under the context of this component. CComponent
getEventHandlers() Returns the list of attached event handlers for an event. CComponent
getHasFooter() CGridColumn
hasEvent() Determines whether an event is defined. CComponent
hasEventHandler() Checks whether the named event has attached handlers. CComponent
hasProperty() Determines whether a property is defined. CComponent
init() Initializes the column. CCheckBoxColumn
raiseEvent() Raises an event. CComponent
renderDataCell() Renders a data cell. CGridColumn
renderFilterCell() Renders the filter cell. CGridColumn
renderFooterCell() Renders the footer cell. CGridColumn
renderHeaderCell() Renders the header cell. CGridColumn

Protected Methods

Hide inherited methods

MethodDescriptionDefined By
renderDataCellContent() Renders the data cell content. CCheckBoxColumn
renderFilterCellContent() Renders the filter cell content. CGridColumn
renderFooterCellContent() Renders the footer cell content. CGridColumn
renderHeaderCellContent() Renders the header cell content. CCheckBoxColumn

Property Details

checkBoxHtmlOptions property
public array $checkBoxHtmlOptions;

the HTML options for the checkboxes.

name property
public string $name;

the attribute name of the data model. The corresponding attribute value will be rendered in each data cell as the checkbox value. Note that if value is specified, this property will be ignored.

See Also

value property
public string $value;

a PHP expression that will be evaluated for every data cell and whose result will be rendered in each data cell as the checkbox value. In this expression, the variable $row the row number (zero-based); $data the data model for the row; and $this the column object.

Method Details

init() method
public void init()

Initializes the column. This method registers necessary client script for the checkbox column.

renderDataCellContent() method
protected void renderDataCellContent(integer $row, mixed $data)
$row integer the row number (zero-based)
$data mixed the data associated with the row

Renders the data cell content. This method renders a checkbox in the data cell.

renderHeaderCellContent() method
protected void renderHeaderCellContent()

Renders the header cell content. This method will render a checkbox in the header when CGridView::selectableRows is greater than 1.