public function __construct($dependetModelRule, $relationToValuesRule, $field_label = null) { parent::__construct($dependetModelRule, $field_label); $this->setRelModel($dependetModelRule); $this->setRelationToValuesRule($relationToValuesRule); $this->setXtype('superboxselect'); }
public function __construct($field_name = null, $field_label = null) { parent::__construct($field_name, $field_label); $this->setValueField(false); $this->setTriggerAction('all'); $this->setCtCls('comboboxtext'); }
public function getTemplateVars($values, $fieldNamePostfix = '', $idPrefix = '') { $ret = parent::getTemplateVars($values, $fieldNamePostfix, $idPrefix); $store = $this->_getStoreData(); if (!$store['data'] && $this->getHideIfNoValues()) { $ret['html'] = ''; $ret['item'] = null; return $ret; } $name = $this->getFieldName(); $value = isset($values[$name]) ? $values[$name] : $this->getDefaultValue(); //todo: escapen $ret['id'] = $idPrefix . str_replace(array('[', ']'), array('_', '_'), $name . $fieldNamePostfix); $style = ''; if ($this->getWidth()) { $style = " style=\"width: " . $this->getWidth() . "px\""; } $cssClass = $this->getCls(); $ret['html'] = "<select id=\"{$ret['id']}\" name=\"{$name}{$fieldNamePostfix}\"{$style} class=\"{$cssClass}\">"; //todo: andere values varianten ermöglichen //todo: html wählt ersten wert vor-aus - ext galub ich nicht // => sollte sich gleich verhalten. if ($this->getShowNoSelection()) { $emptyText = $this->getEmptyText(); if ($emptyText) { $emptyText = '(' . $emptyText . ')'; } array_unshift($store['data'], array('', $emptyText)); } $disabledValues = $this->getDisabledValues(); foreach ($store['data'] as $i) { $ret['html'] .= '<option value="' . $i[0] . '"'; if ($disabledValues && in_array($i[0], $disabledValues)) { $ret['html'] .= ' disabled="disabled"'; } if (!is_null($value) && $i[0] == $value) { $ret['html'] .= ' selected="selected"'; } $ret['html'] .= '>' . htmlspecialchars($i[1]) . '</option>'; } $ret['html'] .= "</select>\n"; if ($this->getSubmitOnChange()) { $ret['html'] .= '<input class="submit" type="submit" value="»" />'; } $ret['html'] = '<div class="outerSelect">' . $ret['html'] . '</div>'; return $ret; }