Skip to content

vksee/yii2-multi-select-widget

 
 

Repository files navigation

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

About

MultiSelect renders a Multiselect Bootstrap widget

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 64.8%
  • CSS 35.2%