Code Monkey home page Code Monkey logo

yii2-autocomplete-widget's Introduction

Bootstrap Autocomplete widget for YII2

Yii2 Latest Version Build Status Software License

The Autocomplete extension is a Yii2 wrapper widget for for the Autocomplete for jQuery plugin. AutoComplete allows you to easily create autocomplete/autosuggest boxes for text input fields.

Has no dependencies other than jQuery. The widget is specially styled for Bootstrap 3.

Installation

The preferred way to install this extension is through composer.

To install, either run

$ php composer.phar require anmaslov/yii2-autocomplete-widget "*"

or add

"anmaslov/yii2-autocomplete-widget": "*"

to the require section of your composer.json file.

Usage

Get data from model

$data = Link::find()
            ->select('title as value')
            ->asArray()
            ->all();

In view

use anmaslov\autocomplete\AutoComplete;

echo AutoComplete::widget([
            'name' => 'link',
            'data' =>  $model,
             'clientOptions' => [
                 'minChars' => 2,
             ],
        ])

License

yii2-autocomplete-widget is released under the MIT License.

yii2-autocomplete-widget's People

Contributors

anmaslov avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yii2-autocomplete-widget's Issues

Lack of 'select' functionality for JsExpression

echo anmaslov\autocomplete\AutoComplete::widget([
'name' => 'Auto',
'data' => $data,
'options' => ['id' => 'autocomp', 'class' => 'form-control', 'placeholder' => 'Enter a query...'],
'clientOptions' => [
'minChars'=>'2',
'autoFill'=> true,
'select' => new JsExpression("
function( event, ui ) {
$('#userid').val(ui.item.id);//#userid is the id of hiddenInput.
}"
)],
]);

Selection functionality not applicable?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.