https://github.com/2amigos/yii2-selectize-widget
Selectize From Brian Reavis Yii2 Widget
https://github.com/2amigos/yii2-selectize-widget
2amigos selectize widget yii
Last synced: 5 months ago
JSON representation
Selectize From Brian Reavis Yii2 Widget
- Host: GitHub
- URL: https://github.com/2amigos/yii2-selectize-widget
- Owner: 2amigos
- License: other
- Archived: true
- Created: 2014-01-14T11:04:00.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2018-06-08T14:21:01.000Z (almost 8 years ago)
- Last Synced: 2024-09-22T22:01:58.388Z (over 1 year ago)
- Topics: 2amigos, selectize, widget, yii
- Language: PHP
- Size: 121 KB
- Stars: 73
- Watchers: 20
- Forks: 41
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Selectize JS Widget for Yii2
[](https://github.com/2amigos/yii2-selectize-widget/tags)
[](LICENSE.md)
[](https://travis-ci.org/2amigos/yii2-selectize-widget)
[](https://scrutinizer-ci.com/g/2amigos/yii2-selectize-widget/code-structure)
[](https://scrutinizer-ci.com/g/2amigos/yii2-selectize-widget)
[](https://packagist.org/packages/2amigos/yii2-selectize-widget)
[Selectize](https://selectize.github.io/selectize.js/) is an extensible jQuery-based custom <select> UI control. It's useful for tagging, contact lists, country selectors, and so on. It clocks in at around ~7kb (gzipped). The goal is to provide a solid & usable experience with a clean and powerful API.
## Installation
The preferred way to install this extension is through [composer](http://getcomposer.org/download/).
Either run
```bash
$ composer require 2amigos/yii2-selectize-widget:~1.0
```
or add
```
"2amigos/yii2-selectize-widget": "~1.0"
```
to the `require` section of your `composer.json` file.
## Usage
Selectize has lots of configuration options. For further information, please check the Selectize plugin [website](https://selectize.github.io/selectize.js/).
### Text input widget
To use text input widget add the following to the view
```php
use dosamigos\selectize\SelectizeTextInput;
echo SelectizeTextInput::widget([
'name' => 'tags',
'value' => 'love, this, game',
'clientOptions' => [
// ...
],
]);
```
### Dropdown list widget
To use dropdown list widget add the following to the view
```php
use dosamigos\selectize\SelectizeDropDownList;
echo SelectizeDropDownList::widget([
'name' => 'tags',
'items' => ['love', 'this', 'game'],
'clientOptions' => [
// ...
],
]);
```
## Configuration
SelectizeDropDownList extends from [InputWidget](http://www.yiiframework.com/doc-2.0/yii-widgets-inputwidget.html), but have additional properties that can be configured.
|Property|Type|Default|Description
|-|-|-|-|
|`loadUrl`|string|array|null|Optional. This parameter will be passed to [Url::to](http://www.yiiframework.com/doc-2.0/guide-runtime-routing.html). If set, selectize plugin will be configured to send ajax requests to the defined url to retrieve options. Url must return a valid JSON response. |
|`queryParam`|string|'query'|The name of the request parameter to use on ajax requests|
|`clientOptions`|array|null|Configuration of selectize plugin. This configuration is individual for each selectize instance.|
## Testing
```bash
$ ./vendor/bin/phpunit
```
## Contributing
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## Credits
- [Antonio Ramirez](https://github.com/tonydspaniard)
- [All Contributors](https://github.com/2amigos/yii2-selectize-widget/graphs/contributors)
## License
The BSD License (BSD). Please see [License File](LICENSE.md) for more information.

web development has never been so fun
www.2amigos.us