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 \Prado\Web\UI\WebControls\setDataTextField. You can customize the display by setting \Prado\Web\UI\WebControls\setDataTextFormatString.
If \Prado\Web\UI\WebControls\setReadOnly 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 \Prado\Web\UI\WebControls\setDataValueField.
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 \Prado\Web\UI\WebControls\setListDataSource. Like generic list controls, you may also want to specify which data fields are used for item values and texts by setting \Prado\Web\UI\WebControls\setListValueField and \Prado\Web\UI\WebControls\setListTextField, respectively. Furthermore, the item texts may be formatted by using \Prado\Web\UI\WebControls\setListTextFormatString. Note, if you specify \Prado\Web\UI\WebControls\setListDataSource, 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.
Class hierarchy
- \Prado\Web\UI\WebControls\TDropDownListColumn
- \Prado\Web\UI\WebControls\TDataGridColumn
- \Prado\TApplicationComponent
- \Prado\TComponent
Since: 3.0.4
public
|
|
public
|
addParsedObject(mixed $object) : mixed
Adds object parsed from template to the control.
This method adds only TListItem objects into the \Prado\Web\UI\WebControls\getItems collection. All other objects are ignored. |
public
|
dataBindColumn(mixed $sender, mixed $param) : mixed
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. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
initializeCell(TTableCell $cell, int $columnIndex, string $itemType) : mixed
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. |
public
|
loadState(mixed $state) : mixed
Loads items from viewstate.
This method overrides the parent implementation by loading list items |
public
|
saveState() : mixed
Saves items into viewstate.
This method overrides the parent implementation by saving list items |
public
|
setDataTextField(string $value) : mixed
Sets the field of the data source that provides the text content of the column.
If this is not set, the data specified via \Prado\Web\UI\WebControls\getDataValueField will be displayed in the column. |
public
|
|
public
|
setDataValueField(string $value) : mixed
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 \Prado\Web\UI\WebControls\getDataTextField (without applying the formatting string) will be used for selection, instead. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
\Prado\TApplicationComponent::FX_CACHE_FILE, \Prado\TComponent::GLOBAL_RAISE_EVENT_LISTENER |