yiiselect2 Wrapper Widget to use jQuery Plugin Select2 in Yii application. Recognized by Igor Vaynberg (Creator of Select2)

  1. Requirements
  2. Usage
  3. Example:
  4. Resources

Wrapper Widget to use jQuery Plugin Select2 in Yii application.

Recognized by Igor Vaynberg (Creator of Select2)

Select2 script: https://github.com/ivaynberg/select2

Requirements

Yii 1.1.13 (Not tested in others)

Usage

In your source code

Yii::import('ext.select2.Select2');

Or in config

...
    'import' => array(
        ...
        'ext.select2.Select2',
        ...
    ),
    ...

Example:

...
    echo Select2::multiSelect("test", null, array('test1','test2'), array(
        'required' => 'required',
        'placeholder' => 'This is a placeholder',
        'select2Options' => array(
            'maximumSelectionSize' => 2,
        ),
    ));
    ...

Or this

...
    $this->widget('Select2', array(
       'name' => 'inputName',
       'value' => 2,
       'data' => array(
           1 => 'Option 1',
           2 => 'Option 2',
           3 => 'Option 3',
           4 => 'Option 4',
        ),
    ));
    ...

Resources

3 1
8 followers
1 165 downloads
Yii Version: 1.1
License: MIT
Category: User Interface
Developed by: Tonin De Rosso Bolzan
Created on: Apr 1, 2013
Last updated: 5 years ago

Downloads

show all

Related Extensions