Class TDataGridColumn
TDataGridColumn class
TDataGridColumn serves as the base class for the different column types of
the TDataGrid
control. TDataGridColumn defines the properties and
methods that are common among all datagrid column types. In particular, it
initializes header and footer cells according to setHeaderText
HeaderText and getHeaderStyle HeaderStyle setFooterText
FooterText and getFooterStyle FooterStyle properties. If setHeaderImageUrl HeaderImageUrl is specified, the image will be displayed
instead in the header cell. The getItemStyle ItemStyle is applied to
cells that belong to non-header and -footer datagrid items.
When the datagrid enables sorting, if the setSortExpression SortExpression is not empty, the header cell will display a button (linkbutton or imagebutton) that will bubble the sort command event to the datagrid.
Since v3.1.0, TDataGridColumn has introduced two new properties setHeaderRenderer HeaderRenderer and setFooterRenderer FooterRenderer
which can be used to specify the layout of header and footer column cells. A
renderer refers to a control class that is to be instantiated as a control. For
more details, see TRepeater
and TDataList
.
Since v3.1.1, TDataGridColumn has introduced setEnableCellGrouping
EnableCellGrouping. If a column has this property set true, consecutive cells
having the same content in this column will be grouped into one cell. Note,
there are some limitations to cell grouping. We determine the cell content
according to the cell's TTableCell::getText Text property. If the text
is empty and the cell has some child controls, we will pick up the first control
who implements IDataRenderer
and obtain its IDataRenderer::getData Data property.
The following datagrid column types are provided by the framework currently,
TBoundColumn
, associated with a specific field in datasource and displays the corresponding data.TEditCommandColumn
, displaying edit/update/cancel command buttonsTDropDownListColumn
, displaying a dropdown list when the item is in edit stateTButtonColumn
, displaying generic command buttons that may be bound to specific field in datasource.THyperLinkColumn
, displaying a hyperlink that may be bound to specific field in datasource.TCheckBoxColumn
, displaying a checkbox that may be bound to specific field in datasource.TTemplateColumn
, displaying content based on templates.
To create your own column class, simply override TDataGridColumn::initializeCell()
method, which is the major logic for managing the data and presentation of cells
in the column.
- TComponent
-
TApplicationComponent
-
TDataGridColumn
Direct known subclasses
TBoundColumn, TButtonColumn, TCheckBoxColumn, TDropDownListColumn, TEditCommandColumn, THyperLinkColumn, TLiteralColumn, TTemplateColumnIndirect known subclasses
TActiveBoundColumn, TActiveButtonColumn, TActiveCheckBoxColumn, TActiveDropDownListColumn, TActiveEditCommandColumn, TActiveHyperLinkColumn, TActiveLiteralColumn, TActiveTemplateColumnPackage: System\Web\UI\WebControls
Copyright: Copyright © 2005-2014 PradoSoft
License: http://www.pradosoft.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 3.0
Located at Web/UI/WebControls/TDataGridColumn.php
public
string
|
|
public
|
#
setID( string $value )
Sets the ID of the column. By explicitly specifying the column ID, one can access the column by $templateControl->ColumnID. |
public
string
|
|
public
|
|
public
string
|
|
public
|
|
public
string
|
|
public
|
|
public
|
|
public
string
|
|
public
|
|
public
string
|
|
public
|
|
public
|
|
public
|
|
public
string
|
|
public
|
|
public
boolean
|
|
public
|
|
public
boolean
|
|
public
|
|
protected
mixed
|
|
protected
|
|
public
|
|
public
mixed
|
|
public
|
|
public
|
|
public
|
|
protected
mixed
|
#
getDataFieldValue( mixed $data, string $field )
|
public
|
#
initializeCell(
Initializes the specified cell to its initial values. The default implementation sets the content of header and footer cells. If sorting is enabled by the grid and sort expression is specified in the column, the header cell will show a link/image button. Otherwise, the header/footer cell will only show static text/image. This method can be overriden to provide customized intialization to column cells. |
public
boolean
|
#
getAllowSorting( )
Returns a value indicating whether this column allows sorting. The column allows sorting only when getSortExpression SortExpression is not empty and the datagrid allows sorting. |
protected
|
|
protected
|
|
protected
string
|
#
formatDataValue( string $formatString, mixed $value )
Formats the text value according to a format string. If the format string is empty, the original value is converted into a string and returned. If the format string starts with '#', the string is treated as a PHP expression within which the token '{0}' is translated with the data value to be formated. Otherwise, the format string and the data value are passed as the first and second parameters in sprintf. |
getApplication(),
getRequest(),
getResponse(),
getService(),
getSession(),
getUser(),
publishAsset(),
publishFilePath()
|
GLOBAL_RAISE_EVENT_LISTENER
|