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.
显示文件
Open project: pradosoft/prado
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 ) |
public addParsedObject ( $object ) |
public dataBindColumn ( $sender, $param ) |
public getDataTextField ( ) : string | ||
return | string | the field of the data source that provides the text content of the column. |
public getDataTextFormatString ( ) : string | ||
return | string | the formatting string used to control how the bound data will be displayed. |
public getDataValueField ( ) : string | ||
return | string | the field of the data source that provides the key selecting an item in dropdown list. |
public getListDataSource ( ) : Traversable | ||
return | Traversable | data source to be bound to the dropdown list boxes. |
public getListTextField ( ) : string | ||
return | string | the data field used to populate the texts of the dropdown list items. Defaults to empty. |
public getListTextFormatString ( ) : string | ||
return | string | the formatting string used to control how the list item texts will be displayed. |
public getListValueField ( ) : string | ||
return | string | the data field used to populate the values of the dropdown list items. Defaults to empty. |
public getReadOnly ( ) : boolean | ||
return | boolean | whether the items in the column can be edited. Defaults to false. |
public initializeCell ( $cell, $columnIndex, $itemType ) |
public loadState ( $state ) |
public saveState ( ) |
public setDataTextField ( $value ) |
public setDataValueField ( $value ) |