定制 xutl/yii2-select2-widget 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

xutl/yii2-select2-widget

Composer 安装命令:

composer require xutl/yii2-select2-widget

包简介

The select2 extension for the Yii framework

README 文档

README

<?= $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
                        };
                    }'),
                ],
            ],
        ]) ?>

统计信息

  • 总下载量: 1.3k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: JavaScript

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2016-10-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固