2017 © Pedro Peláez
 

yii2-extension yii2-select2-widget

The select2 extension for the Yii framework

image

xutl/yii2-select2-widget

The select2 extension for the Yii framework

  • Wednesday, September 27, 2017
  • by xutl
  • Repository
  • 0 Watchers
  • 1 Stars
  • 1,242 Installations
  • JavaScript
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 2 % Grown

The README.md

yii2-select2-widget

= $form->field($model, 'category_id')->widget(Select2::className(), [
            'items' => ArrayHelper::map(\common\models\Category::find()->where(['parent' => null])->asArray()->all(), 'id', 'name'),
            'clientOptions' => [
                'placeholder' => Yii::t('app', 'please choose'),
            ],
        ]) ?>

        <?= $form->field($model, 'tagValues')->widget(Select2::className(), [
            'options' => [
                'multiple' => true
            ],
            'items' => ArrayHelper::map($model->tags, 'id', 'name'),
            'clientOptions' => [
                'placeholder' => Yii::t('app', 'Add the tag you are looking for'),
                'tags' => true,
                'ajax' => [
                    'url' => Url::to(['/user/settings/auto-complete']),
                    'dataType' => 'json',
                    //延迟250ms发送请求
                    'delay' => 250,
                    'cache' => true,
                    'data' => new \yii\web\JsExpression('function (params) {
                        return {
                            query: params.term
                        };
                    }'),
                    'processResults' => new \yii\web\JsExpression('function (data) {
                        return {
                            results: data
                        };
                    }'),
                ],
            ],
        ]) ?>

The Versions

27/09 2017

dev-master

9999999-dev

The select2 extension for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar xutl

yii2 select2

25/10 2016

1.0.0

1.0.0.0

The select2 extension for the Yii framework

  Sources   Download

BSD-3-Clause

The Requires

 

by Avatar xutl

yii2 select2