Skip to content

Latest commit

 

History

History
56 lines (44 loc) · 1.38 KB

README.md

File metadata and controls

56 lines (44 loc) · 1.38 KB

MultiSelect Widget for Yii2

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