2017 © Pedro Peláez
 

yii2-extension yii2-widget-chosen

Bootstrap Chosen widget for Yii2

image

skeeks/yii2-widget-chosen

Bootstrap Chosen widget for Yii2

  • Friday, July 13, 2018
  • by skeeks-semenov
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8,980 Installations
  • HTML
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 12 Versions
  • 5 % Grown

The README.md

Chosen + Bootstrap 3 + Yii2

Credits

Chosen http://harvesthq.github.io/chosen/, (*1)

Chosen Bootstrap Look & Feel https://github.com/dbtek/chosen-bootstrap (with my style fixes), (*2)

Installation

The preferred way to install this extension is through composer., (*3)

Either run, (*4)

php composer.phar require "skeeks/yii2-widget-chosen" "*"

or add, (*5)

"skeeks/yii2-widget-chosen" : "*"

to the require section of your application's composer.json file., (*6)

Usage

With a model, (*7)



= Chosen::widget([
    'model' => $model,
    'attribute' => 'selectable_attr',
    'items' => [1 => 'First item', 2 => 'Second item', 3 => 'Third item'],
    'multiple' => true,
]);?>

= $form->field($model, 'selectable_attr')->widget(
    Chosen::className(), [
        'items' => [1 => 'First item', 2 => 'Second item', 3 => 'Third item'],
        'disableSearch' => 5, // Search input will be disabled while there are fewer than 5 items
        'clientOptions' => [
            'search_contains' => true,
            'single_backstroke_delete' => false,
        ],
]);?>

Without a model, (*8)

<?php
use skeeks\widget\chosen\Chosen;
?>
<?= Chosen::widget([
    'name' => 'ChosenTest',
    'value' => 3,
    'items' => [1 => 'First item', 2 => 'Second item', 3 => 'Third item'],
    'allowDeselect' => false,
    'disableSearch' => true, // Search input will be disabled
    'clientOptions' => [
        'search_contains' => true,
        'max_selected_options' => 2,
    ],
]);?>

To override default placeholder strings you can add translated messages for Select an option (single select) and Select some options (multiple select) to your application message file. By default widget will use 'app' category to translate this strings, but you can set your own category by changing translateCategory option in widget configuration. For example, you can write this in application config file:, (*9)

<?php
\Yii::$container->set('skeeks\widget\chosen\Chosen', [
    'translateCategory' => 'my-app',
]);

Also you can override placeholder text when invoking widget (it can be useful for selects with small width):, (*10)


= Chosen::widget([
    'name' => 'ChosenTest',
    'value' => 3,
    'items' => [1 => 'First item', 2 => 'Second item', 3 => 'Third item'],

    'placeholder' => 'Select',
]);?>

skeeks!
SkeekS CMS (Yii2) — quickly, easily and effectively!
skeeks.com | cms.skeeks.com, (*11)

The Versions

13/07 2018

dev-master

9999999-dev http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD-3-Clause BSD 3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen

13/07 2018

1.2.2

1.2.2.0 http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD-3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen

02/02 2018

1.2.1

1.2.1.0 http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD 3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen

04/11 2017

1.2.0

1.2.0.0 http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD 3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen

13/09 2016

1.1.0

1.1.0.0 http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD 3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen

16/06 2015

dev-release

dev-release http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD 3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen

16/06 2015

1.0.4

1.0.4.0 http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD 3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen

16/06 2015

1.0.5

1.0.5.0 http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD 3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen

17/04 2015

1.0.3

1.0.3.0 http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD 3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen

24/03 2015

1.0.2

1.0.2.0 http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD 3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen

29/01 2015

1.0.1

1.0.1.0 http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD 3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen

30/10 2014

1.0.0

1.0.0.0 http://www.skeeks.com/

Bootstrap Chosen widget for Yii2

  Sources   Download

BSD 3-Clause

The Requires

 

by Semenov Alexander

extension yii2 bootstrap widget skeeks bootstrap 3 chosen