Packages:
default
System
System.Caching
System.Collections
System.Data
System.Data.ActiveRecord
System.Data.ActiveRecord.Relations
System.Data.ActiveRecord.Scaffold
System.Data.ActiveReecord.Scaffold.InputBuilder
System.Data.Commom.Sqlite
System.Data.Common
System.Data.Common.Mssql
System.Data.Common.Mysql
System.Data.Common.Oracle
System.Data.Common.Pgsql
System.Data.Common.Sqlite
System.Data.DataGateway
System.Data.SqlMap
System.Data.SqlMap.Configuration
System.Data.SqlMap.Statements
System.Exceptions
System.I18N
System.IO
System.Security
System.Util
System.Web
System.Web.Services
System.Web.UI
System.Web.UI.ActiveControls
System.Web.UI.WebControls
System.Web.UI.WebControls.assets
System.Xml


Classes:
IDataSource
IItemDataRenderer
IRepeatInfoUser
TActiveFileUpload
TBaseDataList
TBaseValidator
TBoundColumn
TBulletedList
TBulletedListDisplayMode
TBulletedListEventParameter
TBulletStyle
TButton
TButtonColumn
TButtonColumnType
TButtonType
TCaptcha
TCaptchaValidator
TCheckBox
TCheckBoxColumn
TCheckBoxList
TCircleHotSpot
TClientScript
TClientScriptLoader
TClientSideValidationSummaryOptions
TColorPicker
TColorPickerClientSide
TColorPickerMode
TCompareValidator
TCompleteWizardStep
TConditional
TContent
TContentDirection
TContentPlaceHolder
TCustomValidator
TDataBoundControl
TDataGrid
TDataGridColumn
TDataGridColumnCollection
TDataGridCommandEventParameter
TDataGridItem
TDataGridItemCollection
TDataGridItemEventParameter
TDataGridItemRenderer
TDataGridPageChangedEventParameter
TDataGridPager
TDataGridPagerButtonType
TDataGridPagerEventParameter
TDataGridPagerMode
TDataGridPagerPosition
TDataGridPagerStyle
TDataGridSortCommandEventParameter
TDataList
TDataListCommandEventParameter
TDataListItem
TDataListItemCollection
TDataListItemEventParameter
TDataListItemRenderer
TDataRenderer
TDataSourceControl
TDataSourceSelectParameters
TDataSourceView
TDataTypeValidator
TDatePicker
TDatePickerClientScript
TDatePickerInputMode
TDatePickerMode
TDatePickerPositionMode
TDisplayStyle
TDraggable
TDropContainer
TDropDownList
TDropDownListColumn
TEditCommandColumn
TEmailAddressValidator
TExpression
TFileUpload
TFont
THiddenField
THorizontalAlign
THotSpot
THotSpotCollection
THotSpotMode
THtmlArea
THtmlElement
THyperLink
THyperLinkColumn
TImage
TImageButton
TImageClickEventParameter
TImageMap
TImageMapEventParameter
TInlineFrame
TInlineFrameAlign
TInlineFrameScrollBars
TItemDataRenderer
TJavascriptLogger
TKeyboard
TLabel
TLinkButton
TListBox
TListControl
TListControlValidator
TListItem
TListItemCollection
TListItemType
TListSelectionMode
TLiteral
TLiteralColumn
TMarkdown
TMetaTag
TMetaTagCollection
TMultiView
TOutputCache
TOutputCacheCalculateKeyEventParameter
TOutputCacheCheckDependencyEventParameter
TPager
TPagerButtonType
TPagerMode
TPagerPageChangedEventParameter
TPanel
TPanelStyle
TPlaceHolder
TPolygonHotSpot
TRadioButton
TRadioButtonList
TRangeValidationDataType
TRangeValidator
TRatingList
TReadOnlyDataSource
TReadOnlyDataSourceView
TRectangleHotSpot
TRegularExpressionValidator
TRepeatDirection
TRepeater
TRepeaterCommandEventParameter
TRepeaterItem
TRepeaterItemCollection
TRepeaterItemEventParameter
TRepeaterItemRenderer
TRepeatInfo
TRepeatLayout
TRequiredFieldValidator
TSafeHtml
TScrollBars
TServerValidateEventParameter
TSlider
TSliderClientScript
TSliderDirection
TStatements
TStyle
TStyleSheet
TTable
TTableCaptionAlign
TTableCell
TTableCellCollection
TTableFooterRow
TTableGridLines
TTableHeaderCell
TTableHeaderRow
TTableHeaderScope
TTableItemStyle
TTableRow
TTableRowCollection
TTableRowSection
TTableStyle
TTabPanel
TTabView
TTabViewCollection
TTemplateColumn
TTemplatedWizardStep
TTextAlign
TTextBox
TTextBoxAutoCompleteType
TTextBoxMode
TTextHighlighter
TTextHighlighterLineNumberStyle
TValidationCompareOperator
TValidationDataType
TValidationSummary
TValidationSummaryDisplayMode
TValidationSummaryDisplayStyle
TValidatorClientSide
TValidatorDisplayStyle
TVerticalAlign
TView
TViewCollection
TWebControl
TWebControlAdapter
TWizard
TWizardFinishNavigationTemplate
TWizardNavigationButtonStyle
TWizardNavigationButtonType
TWizardNavigationContainer
TWizardNavigationEventParameter
TWizardNavigationTemplate
TWizardSideBarListItemTemplate
TWizardSideBarTemplate
TWizardStartNavigationTemplate
TWizardStep
TWizardStepCollection
TWizardStepNavigationTemplate
TWizardStepType
TXmlTransform
Keyword

Class TDataGridColumn

TComponent
   |
   --TApplicationComponent
      |
      --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 HeaderText and HeaderStyle FooterText and FooterStyle properties. If HeaderImageUrl is specified, the image will be displayed instead in the header cell. The ItemStyle is applied to cells that belong to non-header and -footer datagrid items.

When the datagrid enables sorting, if the 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 HeaderRenderer and 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 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 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 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 buttons
  • TDropDownListColumn, displaying a dropdown list when the item is in edit state
  • TButtonColumn, 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 initializeCell() method, which is the major logic for managing the data and presentation of cells in the column.

Since: 3.0
Author: Qiang Xue <qiang.xue@gmail.com>

Method Summary
protected  string
formatDataValue ( string $formatString, mixed $value)
Formats the text value according to a format string.
boolean
Returns a value indicating whether this column allows sorting.
protected  mixed
getDataFieldValue ( mixed $data, string $field)
Fetches the value of the data at the specified field.
boolean
string
TTableItemStyle
getFooterStyle ( boolean $createStyle)
string
string
string
TTableItemStyle
getHeaderStyle ( boolean $createStyle)
string
string
getID ()
TTableItemStyle
getItemStyle ( boolean $createStyle)
TDataGrid
string
protected  mixed
getViewState ( string $key, mixed $defaultValue)
Returns a viewstate value.
boolean
getVisible ( mixed $checkParents)
void
Initializes the column.
void
initializeCell ( TTableCell $cell, integer $columnIndex, string $itemType)
Initializes the specified cell to its initial values.
protected  void
initializeFooterCell ( TTableCell $cell, integer $columnIndex)
Initializes the footer cell.
protected  void
initializeHeaderCell ( TTableCell $cell, integer $columnIndex)
Initializes the header cell.
void
loadState ( mixed $state)
Loads persistent state values.
mixed
Saves persistent state values.
void
setEnableCellGrouping ( boolean $value)
void
setFooterRenderer ( string $value)
Sets the column footer cell renderer class.
void
setFooterText ( string $value)
void
setHeaderImageUrl ( string $value)
void
setHeaderRenderer ( string $value)
Sets the column header cell renderer class.
void
setHeaderText ( string $value)
void
setID ( string $value)
Sets the ID of the column.
void
setOwner ( TDataGrid $value)
void
setSortExpression ( string $value)
protected  void
setViewState ( string $key, mixed $value, mixed $defaultValue)
Sets a viewstate value.
void
setVisible ( boolean $value)
Methods Inherited From TApplicationComponent
TApplicationComponent::getApplication(), TApplicationComponent::getRequest(), TApplicationComponent::getResponse(), TApplicationComponent::getService(), TApplicationComponent::getSession(), TApplicationComponent::getUser(), TApplicationComponent::publishAsset(), TApplicationComponent::publishFilePath()
Methods Inherited From TComponent
TComponent::addParsedObject(), TComponent::attachEventHandler(), TComponent::canGetProperty(), TComponent::canSetProperty(), TComponent::createdOnTemplate(), TComponent::detachEventHandler(), TComponent::evaluateExpression(), TComponent::evaluateStatements(), TComponent::getEventHandlers(), TComponent::getSubProperty(), TComponent::hasEvent(), TComponent::hasEventHandler(), TComponent::hasProperty(), TComponent::raiseEvent(), TComponent::setSubProperty(), TComponent::__get(), TComponent::__set()

Method Details

formatDataValue

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 http://www.php.net/sprintf.

Input
string$formatStringformat string
mixed$valuethe data to be formatted
Output
string the formatted result
Exception

getAllowSorting

public boolean getAllowSorting ()

Returns a value indicating whether this column allows sorting.

The column allows sorting only when SortExpression is not empty and the datagrid allows sorting.

Output
boolean whether this column allows sorting
Exception

getDataFieldValue

protected mixed getDataFieldValue (mixed $data , string $field )

Fetches the value of the data at the specified field.

If the data is an array, the field is used as an array key. If the data is an of TMap, TList or their derived class, the field is used as a key value. If the data is a component, the field is used as the name of a property.

Input
mixed$datadata containing the field of value
string$fieldthe data field
Output
mixed data value at the specified field
Exception
throwsTInvalidDataValueException if the data or the field is invalid.

getEnableCellGrouping

public boolean getEnableCellGrouping ()

Output
boolean whether cells having the same content should be grouped together. Defaults to false.
Exception

getFooterRenderer

public string getFooterRenderer ()

Output
string the class name for the column footer cell renderer. Defaults to empty, meaning not set.
Exception

getFooterStyle

public TTableItemStyle getFooterStyle (boolean $createStyle )

Input
boolean$createStylewhether to create a style if previously not existing
Output
TTableItemStyle the style for footer
Exception

getFooterText

public string getFooterText ()

Output
string the text to be displayed in the footer of this column
Exception

getHeaderImageUrl

public string getHeaderImageUrl ()

Output
string the url of the image to be displayed in header
Exception

getHeaderRenderer

public string getHeaderRenderer ()

Output
string the class name for the column header cell renderer. Defaults to empty, meaning not set.
Exception

getHeaderStyle

public TTableItemStyle getHeaderStyle (boolean $createStyle )

Input
boolean$createStylewhether to create a style if previously not existing
Output
TTableItemStyle the style for header
Exception

getHeaderText

public string getHeaderText ()

Output
string the text to be displayed in the header of this column
Exception

getID

public string getID ()

Output
string the ID of the column.
Exception

getItemStyle

public TTableItemStyle getItemStyle (boolean $createStyle )

Input
boolean$createStylewhether to create a style if previously not existing
Output
TTableItemStyle the style for item
Exception

getOwner

public TDataGrid getOwner ()

Output
TDataGrid datagrid that owns this column
Exception

getSortExpression

public string getSortExpression ()

Output
string the name of the field or expression for sorting
Exception

getViewState

protected mixed getViewState (string $key , mixed $defaultValue )

Returns a viewstate value.

Input
string$keythe name of the viewstate value to be returned
mixed$defaultValuethe default value. If $key is not found in viewstate, $defaultValue will be returned
Output
mixed the viewstate value corresponding to $key
Exception

getVisible

public boolean getVisible (mixed $checkParents )

Input
mixed$checkParents
Output
boolean whether the column is visible. Defaults to true.
Exception

initialize

public void initialize ()

Initializes the column.

This method is invoked by TDataGrid when the column is about to be used to initialize datagrid items. Derived classes may override this method to do additional initialization.

Output
Exception

initializeCell

public void initializeCell (TTableCell $cell , integer $columnIndex , string $itemType )

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.

Input
TTableCell$cellthe cell to be initialized.
integer$columnIndexthe index to the Columns property that the cell resides in.
string$itemTypethe type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem)
Output
Exception

initializeFooterCell

protected void initializeFooterCell (TTableCell $cell , integer $columnIndex )

Initializes the footer cell.

This method attempts to use FooterRenderer to instantiate the footer cell. If that is not available, it will populate the cell with a text string specified by getFooterImageUrl

Input
TTableCell$cellthe cell to be initialized
integer$columnIndexthe index to the Columns property that the cell resides in.
Output
Exception

initializeHeaderCell

protected void initializeHeaderCell (TTableCell $cell , integer $columnIndex )

Initializes the header cell.

This method attempts to use HeaderRenderer to instantiate the header cell. If that is not available, it will populate the cell with an image or a text string, depending on HeaderImageUrl and HeaderText property values.

If the column allows sorting, image or text will be created as a button which issues Sort command upon user click.

Input
TTableCell$cellthe cell to be initialized
integer$columnIndexthe index to the Columns property that the cell resides in.
Output
Exception

loadState

public void loadState (mixed $state )

Loads persistent state values.

Input
mixed$statestate values
Output
Exception

saveState

public mixed saveState ()

Saves persistent state values.

Output
mixed values to be saved
Exception

setEnableCellGrouping

public void setEnableCellGrouping (boolean $value )

Input
boolean$valuewhether cells having the same content should be grouped together.
Output
Exception

setFooterRenderer

public void setFooterRenderer (string $value )

Sets the column footer cell renderer class.

If not empty, the class will be used to instantiate as a child control in the column footer cell. If the class implements IDataRenderer, the Data property will be set as the FooterText.

Input
string$valuethe renderer class name in namespace format.
Output
Exception

setFooterText

public void setFooterText (string $value )

Input
string$valuetext to be displayed in the footer of this column
Output
Exception

setHeaderImageUrl

public void setHeaderImageUrl (string $value )

Input
string$valuethe url of the image to be displayed in header
Output
Exception

setHeaderRenderer

public void setHeaderRenderer (string $value )

Sets the column header cell renderer class.

If not empty, the class will be used to instantiate as a child control in the column header cell. If the class implements IDataRenderer, the Data property will be set as the FooterText.

Input
string$valuethe renderer class name in namespace format.
Output
Exception

setHeaderText

public void setHeaderText (string $value )

Input
string$valuetext to be displayed in the header of this column
Output
Exception

setID

public void setID (string $value )

Sets the ID of the column.

By explicitly specifying the column ID, one can access the column by $templateControl->ColumnID.

Input
string$valuethe ID of the column.
Output
Exception
throwsTInvalidDataValueException if the ID is of bad format

setOwner

public void setOwner (TDataGrid $value )

Input
TDataGrid$valuedatagrid object that owns this column
Output
Exception

setSortExpression

public void setSortExpression (string $value )

Input
string$valuethe name of the field or expression for sorting
Output
Exception

setViewState

protected void setViewState (string $key , mixed $value , mixed $defaultValue )

Sets a viewstate value.

Make sure that the viewstate value must be serializable and unserializable.

Input
string$keythe name of the viewstate value
mixed$valuethe viewstate value to be set
mixed$defaultValuedefault value. If $value===$defaultValue, the item will be cleared from the viewstate.
Output
Exception

setVisible

public void setVisible (boolean $value )

Input
boolean$valuewhether the column is visible
Output
Exception