CLinkColumn
Package | zii.widgets.grid |
---|---|
Inheritance | class CLinkColumn » CGridColumn » CComponent |
Since | 1.1 |
Version | $Id: CLinkColumn.php 3424 2011-10-24 20:13:19Z mdomba $ |
Source Code | framework/zii/widgets/grid/CLinkColumn.php |
The label and url properties determine how each hyperlink will be rendered. The labelExpression, urlExpression properties may be used instead if they are available. In addition, if imageUrl is set, an image link will be rendered.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
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 |
footer | string | the footer cell text. | CGridColumn |
footerHtmlOptions | array | the HTML options for the footer cell tag. | CLinkColumn |
grid | CGridView | the grid view object that owns this column. | CGridColumn |
hasFooter | boolean | whether this column has a footer cell. | CGridColumn |
header | string | the header cell text. | CGridColumn |
headerHtmlOptions | array | the HTML options for the header cell tag. | CLinkColumn |
htmlOptions | array | the HTML options for the data cell tags. | CLinkColumn |
id | string | the ID of this column. | CGridColumn |
imageUrl | string | the URL to the image. | CLinkColumn |
label | string | the label to the hyperlinks in the data cells. | CLinkColumn |
labelExpression | string | a PHP expression that will be evaluated for every data cell and whose result will be rendered as the label of the hyperlink of the data cells. | CLinkColumn |
linkHtmlOptions | array | the HTML options for the hyperlinks | CLinkColumn |
url | string | the URL of the hyperlinks in the data cells. | CLinkColumn |
urlExpression | string | a PHP expression that will be evaluated for every data cell and whose result will be rendered as the URL of the hyperlink of the data cells. | CLinkColumn |
visible | boolean | whether this column is visible. | CGridColumn |
Public Methods
Method | Description | Defined 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() | Returns whether this column has a footer cell. This is determined based on whether footer is set. | 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. | CGridColumn |
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
Method | Description | Defined By |
---|---|---|
renderDataCellContent() | Renders the data cell content. | CLinkColumn |
renderFilterCellContent() | Renders the filter cell content. | CGridColumn |
renderFooterCellContent() | Renders the footer cell content. | CGridColumn |
renderHeaderCellContent() | Renders the header cell content. | CGridColumn |
Property Details
the HTML options for the footer cell tag.
the HTML options for the header cell tag.
the HTML options for the data cell tags.
the URL to the image. If this is set, an image link will be rendered.
the label to the hyperlinks in the data cells. Note that the label will not be HTML-encoded when rendering. This property is ignored if labelExpression is set.
See Also
a PHP expression that will be evaluated for every data cell and whose result will be rendered
as the label of the hyperlink of the data cells. In this expression, the variable
$row
the row number (zero-based); $data
the data model for the row;
and $this
the column object.
the HTML options for the hyperlinks
the URL of the hyperlinks in the data cells. This property is ignored if urlExpression is set.
See Also
a PHP expression that will be evaluated for every data cell and whose result will be rendered
as the URL of the hyperlink of the data cells. 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
protected void renderDataCellContent(integer $row, mixed $data)
| ||
$row | integer | the row number (zero-based) |
$data | mixed | the data associated with the row |
protected function renderDataCellContent($row,$data)
{
if($this->urlExpression!==null)
$url=$this->evaluateExpression($this->urlExpression,array('data'=>$data,'row'=>$row));
else
$url=$this->url;
if($this->labelExpression!==null)
$label=$this->evaluateExpression($this->labelExpression,array('data'=>$data,'row'=>$row));
else
$label=$this->label;
$options=$this->linkHtmlOptions;
if(is_string($this->imageUrl))
echo CHtml::link(CHtml::image($this->imageUrl,$label),$url,$options);
else
echo CHtml::link($label,$url,$options);
}
Renders the data cell content. This method renders a hyperlink in the data cell.