PHP 클래스 kartik\select2\Select2

또한 보기: https://github.com/select2/select2
부터: 1.0
저자: Kartik Visweswaran ([email protected])
상속: extends kartik\base\InputWidget
파일 보기 프로젝트 열기: kartik-v/yii2-widget-select2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$accesskey Implements open selector with accesskey
$addon addon to prepend or append to the Select2 widget - prepend: _array_|_string_, the prepend addon configuration. If set as a string will be rendered as is. If set as an array, the following properties can be set: - content: _string_, the prepend addon content. - asButton: _boolean, whether the addon is a button or button group. Defaults to false. - append: _array_|_string_, the append addon configuration. If set as a string will be rendered as is. If set as an array, the following properties can be set: - content: _string_, the append addon content. - asButton: _boolean, whether the addon is a button or button group. Defaults to false. - groupOptions: _array_, HTML options for the input group - contentBefore: _string_, content placed before addon - contentAfter: _string_, content placed after addon
$changeOnReset whether to trigger change for Select2 input on form reset so the Select2 value is rightly reset.
$data array the option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using [[ArrayHelper::map()]].
$hideSearch whether to hide the search control and render it as a simple select.
$initValueText
$language the locale ID (e.g. 'fr', 'de') for the language to be used by the Select2 Widget. If this property not set, then the current application language will be used.
$maintainOrder whether to maintain the order of tag / option selected for a multiple select
$options the HTML attributes for the input tag. The following options are important: - multiple: _boolean_, whether multiple or single item should be selected. Defaults to false. - placeholder: _string_, placeholder for the select item.
$pluginName the name of the jQuery plugin
$showToggleAll whether to show the toggle all button for selection all options in a multiple select.
$size Size of the Select2 input, must be one of the [[Select2::LARGE]], [[Select2::MEDIUM]] or [[Select2::SMALL]].
$theme the theme name to be used for styling the Select2.
$toggleAllSettings the toggle all button settings for selecting/unselecting all the options. This is applicable only for multiple select. The following array key properties can be set: - selectLabel: _string_, the markup to be shown to select all records. Defaults to: Select all. - unselectLabel: _string_, the markup to be shown to unselect all records. Defaults to: Unselect all. - selectOptions: _array_, the HTML attributes for the container wrapping the select label. Defaults to []. - unselectOptions: _array_, the HTML attributes for the container wrapping the unselect label. Defaults to []. - options: _array_, the HTML attributes for the toggle button container. Defaults to: ['class' => 's2-togall-button'].

보호된 프로퍼티들

프로퍼티 타입 설명
$_inbuiltThemes list of inbuilt themes
$_msgCat
$_s2OptionsVar the variable that will store additional options for Select2 to add enhanced features after the plugin is loaded and initialized. This variable name will be stored as a data attribute data-s2-options within the base select input options.

공개 메소드들

메소드 설명
registerAssetBundle ( ) Registers the asset bundle and locale
registerAssets ( ) Registers the client assets for Select2 widget.
renderWidget ( ) Initializes and renders the widget
run ( )

보호된 메소드들

메소드 설명
embedAddon ( string $input ) : string Embeds the input group addon
initPlaceholder ( ) Initializes the placeholder for Select2
parseBool ( mixed $var ) : yii\web\JsExpression Parses the variable for boolean value and returns a right JS expression
renderInput ( ) Renders the source Input for the Select2 plugin. Graceful fallback to a normal HTML select dropdown or text input - in case JQuery is not supported by the browser
renderToggleAll ( ) Initializes and render the toggle all button

메소드 상세

embedAddon() 보호된 메소드

Embeds the input group addon
protected embedAddon ( string $input ) : string
$input string
리턴 string

initPlaceholder() 보호된 메소드

Initializes the placeholder for Select2
protected initPlaceholder ( )

parseBool() 보호된 정적인 메소드

Parses the variable for boolean value and returns a right JS expression
protected static parseBool ( mixed $var ) : yii\web\JsExpression
$var mixed the variable value to parse
리턴 yii\web\JsExpression

registerAssetBundle() 공개 메소드

Registers the asset bundle and locale
public registerAssetBundle ( )

registerAssets() 공개 메소드

Registers the client assets for Select2 widget.
public registerAssets ( )

renderInput() 보호된 메소드

Renders the source Input for the Select2 plugin. Graceful fallback to a normal HTML select dropdown or text input - in case JQuery is not supported by the browser
protected renderInput ( )

renderToggleAll() 보호된 메소드

Initializes and render the toggle all button
protected renderToggleAll ( )

renderWidget() 공개 메소드

Initializes and renders the widget
public renderWidget ( )

run() 공개 메소드

public run ( )

프로퍼티 상세

$_inbuiltThemes 보호되어 있는 정적으로 프로퍼티

list of inbuilt themes
protected static $_inbuiltThemes

$_msgCat 보호되어 있는 프로퍼티

protected $_msgCat

$_s2OptionsVar 보호되어 있는 프로퍼티

the variable that will store additional options for Select2 to add enhanced features after the plugin is loaded and initialized. This variable name will be stored as a data attribute data-s2-options within the base select input options.
protected $_s2OptionsVar

$accesskey 공개적으로 프로퍼티

Implements open selector with accesskey
public $accesskey

$addon 공개적으로 프로퍼티

addon to prepend or append to the Select2 widget - prepend: _array_|_string_, the prepend addon configuration. If set as a string will be rendered as is. If set as an array, the following properties can be set: - content: _string_, the prepend addon content. - asButton: _boolean, whether the addon is a button or button group. Defaults to false. - append: _array_|_string_, the append addon configuration. If set as a string will be rendered as is. If set as an array, the following properties can be set: - content: _string_, the append addon content. - asButton: _boolean, whether the addon is a button or button group. Defaults to false. - groupOptions: _array_, HTML options for the input group - contentBefore: _string_, content placed before addon - contentAfter: _string_, content placed after addon
public $addon

$changeOnReset 공개적으로 프로퍼티

whether to trigger change for Select2 input on form reset so the Select2 value is rightly reset.
public $changeOnReset

$data 공개적으로 프로퍼티

the option data items. The array keys are option values, and the array values are the corresponding option labels. The array can also be nested (i.e. some array values are arrays too). For each sub-array, an option group will be generated whose label is the key associated with the sub-array. If you have a list of data models, you may convert them into the format described above using [[ArrayHelper::map()]].
public array $data
리턴 array

$hideSearch 공개적으로 프로퍼티

whether to hide the search control and render it as a simple select.
public $hideSearch

$initValueText 공개적으로 프로퍼티

public $initValueText

$language 공개적으로 프로퍼티

the locale ID (e.g. 'fr', 'de') for the language to be used by the Select2 Widget. If this property not set, then the current application language will be used.
public $language

$maintainOrder 공개적으로 프로퍼티

whether to maintain the order of tag / option selected for a multiple select
public $maintainOrder

$options 공개적으로 프로퍼티

the HTML attributes for the input tag. The following options are important: - multiple: _boolean_, whether multiple or single item should be selected. Defaults to false. - placeholder: _string_, placeholder for the select item.
public $options

$pluginName 공개적으로 프로퍼티

the name of the jQuery plugin
public $pluginName

$showToggleAll 공개적으로 프로퍼티

whether to show the toggle all button for selection all options in a multiple select.
public $showToggleAll

$size 공개적으로 프로퍼티

Size of the Select2 input, must be one of the [[Select2::LARGE]], [[Select2::MEDIUM]] or [[Select2::SMALL]].
public $size

$theme 공개적으로 프로퍼티

the theme name to be used for styling the Select2.
public $theme

$toggleAllSettings 공개적으로 프로퍼티

the toggle all button settings for selecting/unselecting all the options. This is applicable only for multiple select. The following array key properties can be set: - selectLabel: _string_, the markup to be shown to select all records. Defaults to: Select all. - unselectLabel: _string_, the markup to be shown to unselect all records. Defaults to: Unselect all. - selectOptions: _array_, the HTML attributes for the container wrapping the select label. Defaults to []. - unselectOptions: _array_, the HTML attributes for the container wrapping the unselect label. Defaults to []. - options: _array_, the HTML attributes for the toggle button container. Defaults to: ['class' => 's2-togall-button'].
public $toggleAllSettings