Giter VIP home page Giter VIP logo

complety's Introduction

Complety - An Auto Complete Plugin

CI NPM Version Maintainability Sponsor

Complety is a plugin that generates an autocomplete.

Options

Attribute Default Description
cache true enables cache
cacheData {} keeps json results on keys represented by the request url
delay 300 time in milliseconds to delay the search after user typing
functions.getValue undefined function to choose which attribute of json to use on search
keys undefined keys of json that will be highlighted
minChars 1 minimum of chars typed to trigger the search
params {} literal or function params sent to query
suggestion undefined an initial suggestion to be shown
templates.none undefined compiled template used to render suggestion of no results
templates.search undefined compiled template used to render suggestion
url undefined search url
wrappers.field '.complety__field' class used on field
wrappers.item '.complety__item' class used suggestion items
wrappers.itemSelected '.complety__item--selected' class used on selected item of suggestion
wrappers.list '.complety__list' class used on suggestions list
wrappers.loading '.complety__field--loading' class used on field during search
wrappers.none '.complety__none' class used on item that show no result message
wrappers.wrapper '.complety' class used on complety wrapper

Usage

You declare an element with optional data atributes:

<input data-url="/update" type="search">

On JS you can declare attributes too, but data attributes has priority:

$('input').complety({ keys: ['name'] });

Functions

Methods Description
complety.abort() aborts all pending requests
complety.hide() hides the last suggestions
complety.loader('start stop')
complety.readonly(true false)
complety.search('value') executes a search
complety.show() show the last suggestions
complety.suggest(json) suggest a json result
complety.suggestion() returns the selected suggestion
complety.suggestions() returns suggestions from the last search
complety.url() returns the actual builded url
complety.wrappers() returns the wrappers name

Events

Events Description
complety:always when ajax executes always callback. arguments: json, this
complety:fail when ajax executes fail callback. arguments: json, this
complety:done when ajax executes done callback. arguments: json, this
complety:suggested when some suggestion is displayed: suggestion, this
complety:none when no suggestion result is displayed: arguments: value, this

complety's People

Contributors

wbotelhos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dinesh-07

complety's Issues

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.