CDataColumn
CDataColumn represents a grid view column that is associated with a data attribute or expression.
Either
name or
value should be specified. The former specifies
a data attribute name, while the latter a PHP expression whose value should be rendered instead.
The property
sortable determines whether the grid view can be sorted according to this column.
Note that the
name should always be set if the column needs to be sortable. The
name
value will be used by
CSort to render a clickable link in the header cell to trigger the sorting.
Public Properties
Hide inherited 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 |
| filter |
mixed |
the HTML code representing a filter input (e. |
CDataColumn |
| grid |
CGridView |
the grid view object that owns this column. |
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. |
CDataColumn |
| sortable |
boolean |
whether the column is sortable. |
CDataColumn |
| type |
string |
the type of the attribute value. |
CDataColumn |
| value |
string |
a PHP expression that will be evaluated for every data cell and whose result will be rendered
as the content of the data cells. |
CDataColumn |
| visible |
boolean |
whether this column is visible. |
CGridColumn |
Property Details
public mixed $filter;
the HTML code representing a filter input (e.g. a text field, a dropdown list)
that is used for this data column. This property is effective only when
CGridView::enableFiltering is set true.
If this property is not set, a text field will be generated as the filter input;
If this property is an array, a dropdown list will be generated that uses this property value as
the list options.
public string $name;
the attribute name of the data model. The corresponding attribute value will be rendered
in each data cell. If value is specified, this property will be ignored
unless the column needs to be sortable.
public boolean $sortable;
whether the column is sortable. If so, the header celll will contain a link that may trigger the sorting.
Defaults to true. Note that if name is not set, or if name is not allowed by CSort,
this property will be treated as false.
public string $type;
the type of the attribute value. This determines how the attribute value is formatted for display.
Valid values include those recognizable by CGridView::formatter, such as: raw, text, ntext, html, date, time,
datetime, boolean, number, email, image, url. For more details, please refer to CFormatter.
Defaults to 'text' which means the attribute value will be HTML-encoded.
public string $value;
a PHP expression that will be evaluated for every data cell and whose result will be rendered
as the content 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
Initializes the column.
|
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 evaluates value or name and renders the result.
|
protected void renderFilterCellContent()
|
Renders the filter cell content.
This method will render the filter as is if it is a string.
If filter is an array, it is assumed to be a list of options, and a dropdown selector will be rendered.
Otherwise if filter is not false, a text field is rendered.
|
protected void renderHeaderCellContent()
|
Renders the header cell content.
This method will render a link that can trigger the sorting if the column is sortable.
the layout of the filter and footer properties seem to be misformed.