定制 freesoftwarefactory/yii2-select3 二次开发

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

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

freesoftwarefactory/yii2-select3

最新稳定版本:1.0007

Composer 安装命令:

composer require freesoftwarefactory/yii2-select3

包简介

a specialized jquery based DropDownList component displaying checkboxes as options.

README 文档

README

Display a hybrid between a DropDownList and a Multi-selectable checkboxes.

platform: Yii Framework 2.0

author: Cristian Salazar chileshift.cl/freesoftwarefactory

Preview

Preview

Usage

  1. Via composer,
"require": { "php": ">=5.4.0", "freesoftwarefactory/yii2-select3": "(put version here)" }, 
  1. In your View
<?php use yii\widgets\ActiveForm; use freesoftwarefactory\select3\Select3Widget; $options = [ 'opt1' => "Chevrolet", 'opt2' => "Mazda", 'opt3' => "Audi", ]; ?> <?php $form = ActiveForm::begin( [ 'id'=>'form1', ]); ?> <div class='row'> <div class='col-md-3'> <?=$form->field($model, 'someAttributeInYourModel') ->widget(Select3Widget::className(), [ 'prompt' => 'Select Provider', 'options' => $options, 'allSelectable' => true, 'allSelectableLabel' => "(All)", 'visibleAtStartup' => false, ]) ?> </div> </div> <?php ActiveForm::end(); ?> 

Receving Values from this Control

Values are base64+json encoded, that is, when you submits a form using this control then you will have something similar to:

eyJvcHQxIjp0cnVlLCJvcHQyIjp0cnVlLCJvcHQzIjpmYWxzZX0= 

Which is a base64 encoded version of this:

 {"opt1":true,"opt2":true,"opt3":false} 

So, you can just call:

$values = json_decode(base64_decode($model->yourAttribute),true); 

Or... just call :)

$values = Select3Widget::getDecodedValueFrom($model, 'yourAttribute'); 

More functions

  1. load items via javascript by calling:
$.fn.select3load($('#widgetid') , { 123 : some , 456 : thing }); 
  1. Disable the control by passing:
[ 'disable'=>true, ] 
  1. Disable/Check some items at startup by calling
[ 'disabledOptions' => ['somekeydisabled'], 'autoSelectOptions' => ['somekeySelectedFromTheBeginning'], ] 
  1. Javascript events to listen for changes
$this->registerJs(" $(document).on('select3-changed', [], function(e, options, widget){ console.log('select3-changed', options, widget); }); "); 

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 3
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固