public function createChildControls() { switch ($this->_type) { case self::FILTER_LIST: $o = new TListBox(); //$o->setSelectionMode($this->_selectionMode); break; case self::FILTER_CHECK: $o = new TCheckBoxList(); break; case self::FILTER_DROP: $o = new TDropDownList(); break; case self::FILTER_RADIO: $o = new TRadioButtonList(); break; default: throw new TInvalidDataTypeException('Type of TFilterList must be on of TFilterList::FILTER_LIST, TFilterList::FILTER_CHECK, ' . 'TFilterList::FILTER_DROP, TFilterList::FILTER_RADIO'); //TODO Put to messages } $o->setPromptText($this->_promptText); $o->setPromptValue($this->_promptValue); $o->setId($this->genFilterId()); $this->_control = $o; $this->createLabel($o->getId()); $this->getControls()->add($o); }
/** * Add rating style class name to the class attribute * when {@link setReadOnly ReadOnly} property is true and when the * {@link setCssClass CssClass} property is empty. * @param THtmlWriter renderer */ public function render($writer) { $writer->addAttribute('id', $this->getClientID()); $this->getPage()->getClientScript()->registerPostBackControl($this->getClientClassName(), $this->getPostBackOptions()); parent::render($writer); }
/** * Creates a new callback control, sets the adapter to * TActiveListControlAdapter. If you override this class, be sure to set the * adapter appropriately by, for example, by calling this constructor. */ public function __construct() { $this->setAdapter(new TActiveListControlAdapter($this)); $this->setAutoPostBack(true); parent::__construct(); }
protected function createEnumControl($container, $column, $record) { $value = $this->getRecordPropertyValue($column, $record); $selectedValues = preg_split('/\\s*,\\s*/', $value); $control = new TRadioButtonList(); $values = $column->getDbTypeValues(); $control->setDataSource($values); $control->dataBind(); $index = $this->getMatchingIndices($values, $selectedValues); if (count($index) > 0) { $control->setSelectedIndex($index[0]); } $control->setID(self::DEFAULT_ID); $control->setCssClass('enum-radio-buttons'); $this->setNotNullProperty($container, $control, $column, $record); return $control; }
/** * Ensure that the ID attribute is rendered and registers the javascript code * for initializing the active control. */ protected function addAttributesToRender($writer) { parent::addAttributesToRender($writer); $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getPostBackOptions()); }