## Class TDropDownListColumn

Description

TDropDownListColumn class

TDropDownListColumn represents a column that is bound to a field in a data source. The cells in the column will be displayed using the data indexed by DataTextField. You can customize the display by setting DataTextFormatString.

If ReadOnly is false, TDropDownListColumn will display cells in edit mode with dropdown lists. Otherwise, a static text is displayed. The currently selected dropndown list item is specified by the data indexed with DataValueField.

There are two approaches to specify the list items available for selection. The first approach uses template syntax as follows,

       <com:TDropDownListColumn ....>
         <com:TListItem Value="1" Text="first item" />
         <com:TListItem Value="2" Text="second item" />
         <com:TListItem Value="3" Text="third item" />
       </com:TDropDownListColumn>

The second approach specifies a data source to be bound to the dropdown lists by setting ListDataSource. Like generic list controls, you may also want to specify which data fields are used for item values and texts by setting ListValueField and ListTextField, respectively. Furthermore, the item texts may be formatted by using ListTextFormatString. Note, if you specify ListDataSource, do it before calling the datagrid's dataBind().

The dropdown list control in the TDropDownListColumn can be accessed by one of the following two methods:

     $datagridItem->DropDownListColumnID->DropDownList
     $datagridItem->DropDownListColumnID->Controls[0]

The second method is possible because the dropdown list control created within the datagrid cell is the first child.

- since: 3.0.4
- version: $Id: TDropDownListColumn.php 1452 2006-09-30 18:40:40Z xue $
- author: Qiang Xue <qiang.xue@gmail.com>

Located in /Web/UI/WebControls/TDropDownListColumn.php (line 61)

    TComponent
       |
       --TApplicationComponent
          |
          --TDataGridColumn
             |
             --TDropDownListColumn

Method Summary
TDropDownListColumn __construct ()
void addParsedObject (mixed $object)
void dataBindColumn (mixed $sender, mixed $param)
string getDataTextField ()
string getDataTextFormatString ()
string getDataValueField ()
Traversable getListDataSource ()
string getListTextField ()
string getListTextFormatString ()
string getListValueField ()
boolean getReadOnly ()
void initializeCell (TTableCell $cell, integer $columnIndex, string $itemType)
void loadState (mixed $state)
void saveState ()
void setDataTextField (string $value)
void setDataTextFormatString (string $value)
void setDataValueField (string $value)
void setListDataSource (Traversable|array|string $value)
void setListTextField (string $value)
void setListTextFormatString (string $value)
void setListValueField (string $value)
void setReadOnly (boolean $value)
Methods
Constructor __construct (line 67)

- access: public

TDropDownListColumn __construct ()
addParsedObject (line 101)

Adds object parsed from template to the control.

This method adds only TListItem objects into the getItems collection. All other objects are ignored.

- access: public

void addParsedObject (mixed $object)

- mixed $object: object parsed from template

Redefinition of:

TComponent::addParsedObject()
  Processes an object that is created during parsing template.

dataBindColumn (line 295)

Databinds a cell in the column.

This method is invoked when datagrid performs databinding. It populates the content of the cell with the relevant data from data source.

- access: public

void dataBindColumn (mixed $sender, mixed $param)
getDataTextField (line 114)

- return: the field of the data source that provides the text content of the column.
- access: public

string getDataTextField ()
getDataTextFormatString (line 133)

- return: the formatting string used to control how the bound data will be displayed.
- access: public

string getDataTextFormatString ()
getDataValueField (line 149)

- return: the field of the data source that provides the key selecting an item in dropdown list.
- access: public

string getDataValueField ()
getListDataSource (line 184)

- return: data source to be bound to the dropdown list boxes.
- access: public

Traversable getListDataSource ()
getListTextField (line 216)

- return: the data field used to populate the texts of the dropdown list items. Defaults to empty.
- access: public

string getListTextField ()
getListTextFormatString (line 232)

- return: the formatting string used to control how the list item texts will be displayed.
- access: public

string getListTextFormatString ()
getListValueField (line 200)

- return: the data field used to populate the values of the dropdown list items. Defaults to empty.
- access: public

string getListValueField ()
getReadOnly (line 168)

- return: whether the items in the column can be edited. Defaults to false.
- access: public

boolean getReadOnly ()
initializeCell (line 256)

Initializes the specified cell to its initial values.

This method overrides the parent implementation. It creates a textbox for item in edit mode and the column is not read-only. Otherwise it displays a static text. The caption of the button and the static text are retrieved from the datasource.

- access: public

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

- TTableCell $cell: the cell to be initialized.
- integer $columnIndex: the index to the Columns property that the cell resides in.
- string $itemType: the type of cell (Header,Footer,Item,AlternatingItem,EditItem,SelectedItem)

Redefinition of:

TDataGridColumn::initializeCell()
  Initializes the specified cell to its initial values.

loadState (line 77)

Loads items from viewstate.

This method overrides the parent implementation by loading list items

- access: public

void loadState (mixed $state)

- mixed $state: state values

Redefinition of:

TDataGridColumn::loadState()
  Loads persistent state values.

saveState (line 89)

Saves items into viewstate.

This method overrides the parent implementation by saving list items

- access: public

void saveState ()

Redefinition of:

TDataGridColumn::saveState()
  Saves persistent state values.

setDataTextField (line 125)

Sets the field of the data source that provides the text content of the column.

If this is not set, the data specified via DataValueField will be displayed in the column.

- access: public

void setDataTextField (string $value)

- string $value: the field of the data source that provides the text content of the column.

setDataTextFormatString (line 141)

- access: public

void setDataTextFormatString (string $value)

- string $value: the formatting string used to control how the bound data will be displayed.

setDataValueField (line 160)

Sets the field of the data source that provides the key selecting an item in dropdown list.

If this is not present, the data specified via DataTextField (without applying the formatting string) will be used for selection, instead.

- access: public

void setDataValueField (string $value)

- string $value: the field of the data source that provides the key selecting an item in dropdown list.

setListDataSource (line 192)

- access: public

void setListDataSource (Traversable|array|string $value)

- Traversable|array|string $value: data source to be bound to the dropdown list boxes.

setListTextField (line 224)

- access: public

void setListTextField (string $value)

- string $value: the data field used to populate the texts of the dropdown list items

setListTextFormatString (line 240)

- access: public

void setListTextFormatString (string $value)

- string $value: the formatting string used to control how the list item texts will be displayed.

setListValueField (line 208)

- access: public

void setListValueField (string $value)

- string $value: the data field used to populate the values of the dropdown list items

setReadOnly (line 176)

- access: public

void setReadOnly (boolean $value)

- boolean $value: whether the items in the column can be edited

#### Inherited Methods

Inherited From TDataGridColumn

> TDataGridColumn::formatDataValue()
> TDataGridColumn::getDataFieldValue()
> TDataGridColumn::getFooterStyle()
> TDataGridColumn::getFooterText()
> TDataGridColumn::getHeaderImageUrl()
> TDataGridColumn::getHeaderStyle()
> TDataGridColumn::getHeaderText()
> TDataGridColumn::getID()
> TDataGridColumn::getItemStyle()
> TDataGridColumn::getOwner()
> TDataGridColumn::getSortExpression()
> TDataGridColumn::getViewState()
> TDataGridColumn::getVisible()
> TDataGridColumn::initialize()
> TDataGridColumn::initializeCell()
> TDataGridColumn::loadState()
> TDataGridColumn::saveState()
> TDataGridColumn::setFooterText()
> TDataGridColumn::setHeaderImageUrl()
> TDataGridColumn::setHeaderText()
> TDataGridColumn::setID()
> TDataGridColumn::setOwner()
> TDataGridColumn::setSortExpression()
> TDataGridColumn::setViewState()
> TDataGridColumn::setVisible()

Inherited From TApplicationComponent

> TApplicationComponent::getApplication()
> TApplicationComponent::getRequest()
> TApplicationComponent::getResponse()
> TApplicationComponent::getService()
> TApplicationComponent::getSession()
> TApplicationComponent::getUser()
> TApplicationComponent::publishAsset()
> TApplicationComponent::publishFilePath()

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()

Documentation generated on Sun, 14 Jan 2007 21:42:20 -0500 by phpDocumentor 1.3.0RC4