Prado\Web\UI\WebControls\TDropDownListColumn::initializeCell PHP Method

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 )
    public function initializeCell($cell, $columnIndex, $itemType)
    {
        if (!$this->_dataBound && $this->_listControl->getDataSource() !== null) {
            $this->_listControl->setDataTextField($this->getListTextField());
            $this->_listControl->setDataValueField($this->getListValueField());
            $this->_listControl->setDataTextFormatString($this->getListTextFormatString());
            $this->_listControl->dataBind();
            $this->_dataBound = true;
        }
        switch ($itemType) {
            case TListItemType::EditItem:
                if (!$this->getReadOnly()) {
                    $listControl = clone $this->_listControl;
                    $cell->getControls()->add($listControl);
                    $cell->registerObject('DropDownList', $listControl);
                    $control = $listControl;
                } else {
                    $control = $cell;
                }
                $control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn'));
                break;
            case TListItemType::Item:
            case TListItemType::AlternatingItem:
            case TListItemType::SelectedItem:
                if ($this->getDataTextField() !== '' || $this->getDataValueField() !== '') {
                    $cell->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn'));
                }
                break;
            default:
                parent::initializeCell($cell, $columnIndex, $itemType);
                break;
        }
    }