PHP Class Prado\Web\UI\WebControls\TDropDownListColumn

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 {@link setDataTextField DataTextField}. You can customize the display by setting {@link setDataTextFormatString DataTextFormatString}. If {@link setReadOnly 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 {@link setDataValueField DataValueField}. There are two approaches to specify the list items available for selection. The first approach uses template syntax as follows, The second approach specifies a data source to be bound to the dropdown lists by setting {@link setListDataSource ListDataSource}. Like generic list controls, you may also want to specify which data fields are used for item values and texts by setting {@link setListValueField ListValueField} and {@link setListTextField ListTextField}, respectively. Furthermore, the item texts may be formatted by using {@link setListTextFormatString ListTextFormatString}. Note, if you specify {@link setListDataSource 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
Author: Qiang Xue ([email protected])
Inheritance: extends TDataGridColumn
Exibir arquivo Open project: pradosoft/prado

Public Methods

Method Description
__construct ( )
addParsedObject ( $object ) Adds object parsed from template to the control.
dataBindColumn ( $sender, $param ) Databinds a cell in the column.
getDataTextField ( ) : string
getDataTextFormatString ( ) : string
getDataValueField ( ) : string
getListDataSource ( ) : Traversable
getListTextField ( ) : string
getListTextFormatString ( ) : string
getListValueField ( ) : string
getReadOnly ( ) : boolean
initializeCell ( $cell, $columnIndex, $itemType ) Initializes the specified cell to its initial values.
loadState ( $state ) Loads items from viewstate.
saveState ( ) Saves items into viewstate.
setDataTextField ( $value ) Sets the field of the data source that provides the text content of the column.
setDataTextFormatString ( $value )
setDataValueField ( $value ) Sets the field of the data source that provides the key selecting an item in dropdown list.
setListDataSource ( $value )
setListTextField ( $value )
setListTextFormatString ( $value )
setListValueField ( $value )
setReadOnly ( $value )

Method Details

__construct() public method

public __construct ( )

addParsedObject() public method

This method adds only {@link TListItem} objects into the {@link getItems Items} collection. All other objects are ignored.
public addParsedObject ( $object )

dataBindColumn() public method

This method is invoked when datagrid performs databinding. It populates the content of the cell with the relevant data from data source.
public dataBindColumn ( $sender, $param )

getDataTextField() public method

public getDataTextField ( ) : string
return string the field of the data source that provides the text content of the column.

getDataTextFormatString() public method

public getDataTextFormatString ( ) : string
return string the formatting string used to control how the bound data will be displayed.

getDataValueField() public method

public getDataValueField ( ) : string
return string the field of the data source that provides the key selecting an item in dropdown list.

getListDataSource() public method

public getListDataSource ( ) : Traversable
return Traversable data source to be bound to the dropdown list boxes.

getListTextField() public method

public getListTextField ( ) : string
return string the data field used to populate the texts of the dropdown list items. Defaults to empty.

getListTextFormatString() public method

public getListTextFormatString ( ) : string
return string the formatting string used to control how the list item texts will be displayed.

getListValueField() public method

public getListValueField ( ) : string
return string the data field used to populate the values of the dropdown list items. Defaults to empty.

getReadOnly() public method

public getReadOnly ( ) : boolean
return boolean whether the items in the column can be edited. Defaults to false.

initializeCell() public method

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.
public initializeCell ( $cell, $columnIndex, $itemType )

loadState() public method

This method overrides the parent implementation by loading list items
public loadState ( $state )

saveState() public method

This method overrides the parent implementation by saving list items
public saveState ( )

setDataTextField() public method

If this is not set, the data specified via {@link getDataValueField DataValueField} will be displayed in the column.
public setDataTextField ( $value )

setDataTextFormatString() public method

public setDataTextFormatString ( $value )

setDataValueField() public method

If this is not present, the data specified via {@link getDataTextField DataTextField} (without applying the formatting string) will be used for selection, instead.
public setDataValueField ( $value )

setListDataSource() public method

public setListDataSource ( $value )

setListTextField() public method

public setListTextField ( $value )

setListTextFormatString() public method

public setListTextFormatString ( $value )

setListValueField() public method

public setListValueField ( $value )

setReadOnly() public method

public setReadOnly ( $value )