Backbone.AutoCompleteView

An auto-complete widget built with Backbone.js

Example

Selected Item

Usage

Create a method that called `label` on your model. That method will be used for representation of model.

var Plugin = Backbone.Model.extend({
    label: function () {
        return this.get("name");
    }
});

Create a collection for auto-completion model.

var PluginCollection = Backbone.Collection.extend({
    model: Plugin
});

And initialize the AutoCompleteView in your view.

new AutoCompleteView({
    input: $("#plugin"), // your input field
    model: plugins // your collection
}).render();

Configuration

Parameter Type Default Description
className string autocomplete The class name of popup menu.
wait integer 300 The throttling value as milliseconds.
minKeywordLength integer 2 Minimum keyword length.
queryParameter string query The search parameter for back-end.
onSelect function no-op The callback function for selected item.

Contribution

https://github.com/fatiherikli/backbone-autocomplete