zertex/yii2-zx-bootstrap-select

为 Yii2 的 Bootstrap-select 小部件。扩展的下拉列表。

1.0.0 2017-03-11 12:59 UTC

This package is not auto-updated.

Last update: 2024-09-28 20:03:50 UTC


README

Bootstrap-select 小部件

安装

安装此扩展的首选方式是通过 composer

运行以下命令:

php composer.phar require --prefer-dist zertex/yii2-zx-bootstrap-select "dev-master"

或者在你的 composer.json 文件的 require 部分添加以下内容:

"zertex/yii2-zx-bootstrap-select": "dev-master"

使用方法

扩展安装后,只需在你的代码中通过以下方式使用它:

<?= $form->field($model, 'field')->widget(Select::className(), [
    'selector' => '.select-picker',
    'options' => [
        'data-live-search' => 'true',
    ],
    'selectOptions' => [
        'style' => 'btn-default form-control',
        'data-live-search' => 'true',
        'width' => '100%',
    ],
    'items' => [
        '1' => 'Item 1',
        '2' => 'Item 2',
        '3' => 'Item 3',
        '4' => 'Item 4',
        '5' => 'Item 5',
    ]
]);
?>```

##Options

* **clientOptions** - options of plugin. See https://silviomoreto.github.io/bootstrap-select/