\TbSelect2

## Select2 wrapper widget

Summary

Methods
Properties
Constants
init()
run()
registerClientScript()
$form
$data
$events
$asDropDownList
$val
$options
$readonly
$disabled
No constants found
No protected methods found
No protected properties found
N/A
setDefaultWidthIfEmpty()
normalizeData()
addEmptyItemIfPlaceholderDefined()
normalizeOptions()
prependDataWithEmptyItem()
No private properties found
N/A

Properties

$form

$form : \TbActiveForm

Type

\TbActiveForm — when created via TbActiveForm. This attribute is set to the form that renders the widget

$data

$data : array

Type

array — @param data for generating the list options (value=>display)

$events

$events : string[]

Type

string[] — the JavaScript event handlers.

$asDropDownList

$asDropDownList : bool

Type

bool — whether to display a dropdown select box or use it for tagging

$val

$val : string

Type

string — the default value.

$options

$options

$readonly

$readonly : bool

Type

bool

$disabled

$disabled : bool

Type

bool

Methods

init()

init()

### .init()

Initializes the widget.

run()

run()

### .run()

Runs the widget.

registerClientScript()

registerClientScript( $id)

### .registerClientScript()

Registers required client script for bootstrap select2. It is not used through bootstrap->registerPlugin in order to attach events if any

Parameters

$id

setDefaultWidthIfEmpty()

setDefaultWidthIfEmpty()

normalizeData()

normalizeData()

addEmptyItemIfPlaceholderDefined()

addEmptyItemIfPlaceholderDefined()

normalizeOptions()

normalizeOptions()

prependDataWithEmptyItem()

prependDataWithEmptyItem()