efureev / yii2-tagsinput
Bootstrap Tags Input is a jQuery plugin providing a Twitter Bootstrap user interface for managing tags.
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 1
Open Issues: 0
Type:yii2-extension
Requires
- bower-asset/fe-tagsinput: ~0.8
- bower-asset/typeahead.js: dev-master
- yiisoft/yii2: ~2
Requires (Dev)
- codeclimate/php-test-reporter: dev-master
- phpunit/phpunit: ~5.5
This package is auto-updated.
Last update: 2024-04-29 02:42:37 UTC
README
without Model
var inputUsers = $('<input type="text">'), users = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace('title'), queryTokenizer: Bloodhound.tokenizers.whitespace, prefetch : { url : '/users.json', cache : false, filter: function (list) { return $.map(list, function (users) { return {text: user.name}; }); } } }); hubs.initialize(); inputUsers.tagsinput({ typeaheadjs: { displayKey: 'text', trimValue : true, valueKey : 'text', name : 'users', source : users.ttAdapter() } });
with Model
<?= $form->field($model, 'users', ['options' => [ 'class' => 'form-group', ]])->widget( \efureev\tagsinput\TagsInput::className(), [ 'preJS' => 'var users = new Bloodhound({ datumTokenizer: Bloodhound.tokenizers.obj.whitespace("title"), queryTokenizer: Bloodhound.tokenizers.whitespace, prefetch : { url : "/users", cache : false, filter: function (list) { return $.map(list, function (user) { return {text: user.name}; }); } } });', 'clientOptions' => [ 'typeaheadjs' => [ 'displayKey' => 'text', 'trimValue' => true, 'valueKey' => 'text', 'name' => 'users', 'source' => new \yii\web\JsExpression('users.ttAdapter()') ] ] ] ); ?>
Tests
vendor/bin/phpunit