dropDownList() публичный Метод

The selection of the drop-down list is taken from the value of the model attribute.
public dropDownList ( array $items, array $options = [] )
$items array the option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using [[ArrayHelper::map()]]. Note, the values and labels will be automatically HTML-encoded by this method, and the blank spaces in the labels will also be HTML-encoded.
$options array the tag options in terms of name-value pairs. For the list of available options please refer to the `$options` parameter of [[\yii\helpers\Html::activeDropDownList()]]. If you set a custom `id` for the input element, you may need to adjust the [[$selectors]] accordingly.
Пример #1
0
 public function dropDownList($items, $options = [], $generateDefault = true)
 {
     if ($generateDefault === true && !isset($options['prompt'])) {
         $options['prompt'] = '请选择';
     }
     return parent::dropDownList($items, $options);
 }
 /**
  * @inheritdoc
  */
 public function dropDownList($items, $options = [])
 {
     $this->initDisability($options);
     Html::addCssClass($options, $this->addClass);
     return parent::dropDownList($items, $options);
 }
Пример #3
0
 /**
  * Renders default browser drop-down list
  * @see http://materializecss.com/forms.html#select
  * @param $items
  * @param array $options
  * @return $this
  */
 public function dropDownListDefault($items, $options = [])
 {
     Html::addCssClass($options, 'browser-default');
     return parent::dropDownList($items, $options);
 }
Пример #4
0
 /**
  * @inheritdoc
  */
 public function dropdownList($items, $options = [])
 {
     Html::addCssClass($this->options, 'dropdownList');
     $options['ng-model'] = ArrayHelper::remove($options, 'ng-model', 'data.' . $this->attribute);
     return parent::dropDownList($items, $options);
 }
Пример #5
0
 /**
  * @inheritdoc
  */
 public function dropDownList($items, $options = [])
 {
     $options = array_merge($this->inputOptions, $options);
     $this->_setWrapperOptions($options, 'select');
     $this->_setIconOptions($options);
     $this->_setTooltipOptions($options);
     if (isset($options['multiple'])) {
         Html::addCssClass($this->wrapperOptions, 'select-multiple');
         Html::addCssClass($options, 'custom-scroll');
     }
     parent::dropDownList($items, $options);
     $this->parts['{input}'] .= isset($options['multiple']) ? '' : '<i></i>';
     return $this;
 }
Пример #6
0
 public function dropDownList($items, $options = [])
 {
     $options['class'] = 'combox';
     return parent::dropDownList($items, $options);
 }