Prado\Web\UI\WebControls\TBoundColumn::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)
    {
        $item = $cell->getParent();
        switch ($itemType) {
            case TListItemType::Item:
            case TListItemType::AlternatingItem:
            case TListItemType::SelectedItem:
                if (($classPath = $this->getItemRenderer()) !== '') {
                    $control = Prado::createComponent($classPath);
                    if ($control instanceof IItemDataRenderer) {
                        $control->setItemIndex($item->getItemIndex());
                        $control->setItemType($item->getItemType());
                    }
                    $cell->getControls()->add($control);
                } else {
                    $control = $cell;
                }
                $control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn'));
                break;
            case TListItemType::EditItem:
                if (!$this->getReadOnly()) {
                    if (($classPath = $this->getEditItemRenderer()) !== '') {
                        $control = Prado::createComponent($classPath);
                        if ($control instanceof IItemDataRenderer) {
                            $control->setItemIndex($item->getItemIndex());
                            $control->setItemType($item->getItemType());
                        }
                        $cell->getControls()->add($control);
                        $cell->registerObject('EditControl', $control);
                    } else {
                        $control = new TTextBox();
                        $cell->getControls()->add($control);
                        $cell->registerObject('TextBox', $control);
                    }
                } else {
                    if (($classPath = $this->getItemRenderer()) !== '') {
                        $control = Prado::createComponent($classPath);
                        if ($control instanceof IItemDataRenderer) {
                            $control->setItemIndex($item->getItemIndex());
                            $control->setItemType($item->getItemType());
                        }
                        $cell->getControls()->add($control);
                    } else {
                        $control = $cell;
                    }
                }
                $control->attachEventHandler('OnDataBinding', array($this, 'dataBindColumn'));
                break;
            default:
                parent::initializeCell($cell, $columnIndex, $itemType);
                break;
        }
    }