abbosxon/yii2-multiselect-widget

There is no license information available for the latest version (dev-master) of this package.

My first widget

Installs: 206

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

Language:JavaScript

Type:yii2-widget

dev-master 2024-05-21 07:32 UTC

This package is auto-updated.

Last update: 2024-05-21 07:32:40 UTC


README

jQuery multiselect plugin with two sides. The user can select one or more items and send them to the other side.

Demo

Installation

The preferred way to install this extension is through composer.

To install the Material Admin Asset run:

composer require abbosxon/yii2-multiselect-widget "dev-master"

Requirements

  • jQuery 1.7 or higher
  • yiisoft/yii2" 2.0.14 or higher,
  • yiisoft/yii2-bootstrap 2.0.0 or higher

Usage example

<?php
use abbosxon\widgets\multiselect\MultiSelect;
use yii\helpers\Url;
?>
<?= MultiSelect::widget([
            'widgetNumber' => 1,
            'valueAttribute' => 'title',
            'keyAttribute' => 'id',
            'leftLabel' => 'Check an option!',
            'rightLabel' => ' - Options selected!',
            'data' => $activeRecordModel::findAll(),
            'selectedData'=>$model->{relation items for $activeRecordModel},
            'addDataUrl'=>Url::to(['link to add relation item', 'id' => $model->id]),
            'removeDataUrl'=>Url::to(['link to remove relation item', 'id' => $model->id]),
            'leftButtonOptions' => ['class'=>'btn-primary'],
            'leftAllButtonOptions' => ['class'=>'btn-primary'],
            'rightButtonOptions' => ['class'=>'btn-primary'],
            'rightAllButtonOptions' => ['class'=>'btn-primary'],
            'listBoxSize' => 25
        ]);?>