定制 yii2-extensions/select2 二次开发

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

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

yii2-extensions/select2

最新稳定版本:0.1

Composer 安装命令:

composer require yii2-extensions/select2

包简介

select2 widget for Yii Framework 2

README 文档

README

Select2 widget for Yii2 framework


php-version PHPUnit PHPUnit Codecov Infection

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist yii2-extensions/select2:^0.1

or add

"yii2-extensions/select2": "^0.1"

to the require section of your composer.json file.

Usage

Dropdown list

use Yii2\Extension\Select2\Select2;

<?= $form->field($model, 'user_id')->widget(Select2::className(), [
        'items' => ArrayHelper::map(User::find()->all(), 'id', function($model) {
            return $model->username . " <{$model->email}>";
        }),
        'clientOptions' => [
            'placeholder' => 'User',
            'allowClear' => true,
        ],
        'clientEvents' => [
            'change'=>'function (e) {
                console.log("Select2 change.");
            }',
        ],
    ]) ?>

Multiple aka Tag mode input

use Yii2\Extension\Select2\Select2;

<?= Select2::widget([
        'name' => 'InputName',
        'items' => ArrayHelper::map(User::find()->all(), 'id', function($model) {
            return $model->fio . " <{$model->email}>";
        }),
        'options' => [ 
            'multiple' => true,
        ]
        'clientOptions' => [
            'placeholder' => 'User',
            'allowClear' => true,
        ]
    ]) ?>

Properties of the widget

For more details see: https://github.com/select2/select2

Special Thanks

This code was initially developed by contributors at yii2-cms and hosted at repo: https://github.com/yii-cms/yii2-select2. We thank them all. For continuity and maintenance we have moved a copy here.

Quality code

static-analysis phpstan-level StyleCI

Support versions Yii2

Yii20 Yii22

Testing

Check the documentation testing to learn about testing.

Our social networks

Twitter

License

The MIT License. Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: mit
  • 更新时间: 2024-09-29

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固