Yii2 – Select2 jQuery Plugin Widget

Category: jQuery | Sub-Category: Forms

Description

yii2-widget-select2

Check out this Select2 jQuery plugin widget – a Yii 2. It supports searching,¬†infinite scrolling of results and remote data sets. This widget is mostly styled for Bootstrap 3. If the current visitor’s browser does not support JQuery field will fall back to HTML select or text input. You can setup model validation rules for a model attribute that uses Select2 widget for input like any other field.

In the latest release there are new functionalities  covered.

  • New theme property which allows you to define themes in Select2 for styling your widget.
  • A new¬†Krajee theme – Select2::THEME_KRAJEE which is specially styled for yii2-widget-select2. This theme matches the bootstrap 3 styling with various enhancements.
  • Additional themes provided in form of Select2::THEME_DEFAULT, Select2::THEME_CLASSIC, and Select2::THEME_BOOTSTRAP. You can now add your own custom theme and modify configuration of the widget
  • query plugin property is no more needed. It is also not necessary to configure data , not even if you have not set tags or query or ajax. Widget will automatically evaluate properties and default values.
  • Improved tagging support. Use it just like a multiple select but with taggable values. Additionally, you can create tags on the fly.
  • Improved ajax support.
  • The initSelection method of Select2 3.5.x plugin is removed. New initValueText property has been provided with the Select2 widget to cover this (e.g. for ajax based loading).
  • Option to disable selective option values for Select2 dropdown OR add HTML attributes to select option fields.
  • Improvement by Krajee to disable the search box so you can use it just like a normal select.
  • Improvements to locales and translations. Usage of multiple language Select2 widgets are now allowed on the same page.