2amigos/yii2-multi-select-widget

Multiselect Bootstrap widget for Yii2.

Installs: 4 198

Dependents: 1

Stars: 18

Watchers: 9

Forks: 11

Open Issues: 3

Language: PHP

0.1.1 2014-05-10 18:32 UTC

README

Renders a MultiSelect Bootstrap plugin widget.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require 2amigos/yii2-multi-select-widget "*"

or add

"2amigos/yii2-multi-select-widget" : "*"

to the require section of your application's composer.json file.

Usage

Using a model:

use dosamigos\multiselect\MultiSelect;

<?= MultiSelect::widget([
    'data' => ['super', 'natural'],
    'name' => 'Test'
]) ?>

Multiselect Option:

echo MultiSelect::widget([
    'id'=>"multiXX",
    "options" => ['multiple'=>"multiple"], // for the actual multiselect
    'data' => [ 0 => 'super', 2 => 'natural'], // data as array
    'value' => [ 0, 2], // if preselected
    'name' => 'multti', // name for the form
    "clientOptions" => 
        [
            "includeSelectAllOption" => true,
            'numberDisplayed' => 2
        ], 
]);

Note: You can make use of 'model' and 'attribute' for its configuration too instead of 'name' and 'value'.

2amigOS!
Web development has never been so fun! www.2amigos.us