Jquery autocomplete options
来源:互联网 发布:java中重写equals方法 编辑:程序博客网 时间:2024/06/07 10:04
Available options
These options are available:
url
default value: none
The url that will be called to provide autocompletion results. If you do not specify this, be sure to specify local data using data.
data
default value: none
Local data for autocompleter. Either provide an array with values or an array of arrays.
Example (array)
data: [ "apple", "apricot", "pear" ]
Example (array of arrays)
data: [ ['apple', 1], ['apricot', 2], ['pear', 3], ['prume', 4] ]
paramName
default value: "q"
The name of the GET parameter that will hold the value of the input element. If you set this to false the autocompleter will add the value of the input field directly to the url.
inputClass
default value: "ac_input"
This class will be added to the input box.
resultsClass
default value: "ac_results"
The class for the UL that will contain the result items (result items are LI elements).
loadingClass
default value: "ac_loading"
The class for the input box while results are being fetched from the server.
lineSeparator
default value: "\n"
The character that separates lines in the results from the backend.
cellSeparator
default value: "|"
The character that separates cells in the results from the backend.
minChars
default value: 1
The minimum number of characters a user has to type before the autocompleter activates.
delay
default value: 400
The delay in milliseconds the autocompleter waits after a keystroke to activate itself.
maxCacheLength
default value: 10
The number of backend query results to store in cache. The higher this number, the more memory the autocompleter will use, but the less HTTP duplicate requests it will make. If set to 1 (the current result), no caching will happen. Do not set below 1.
matchSubset
default value: 1
Whether or not the autocompleter can use a cache for more specific queries. This means that all matches of "foot" are a subset of all matches for "foo". Usually this is true, and using this options decreases server load and increases performance. Remember to set cacheLength to a bigger number, like 10.
matchCase
default value: 0
Whether or not the comparison is case sensitive. Only important only if you use caching.
matchInside
default value: false
Whether or not the comparison looks inside (i.e. does "ba" match "foo bar") the search results. Only important if you use caching.
matchStringConvertor
default value: null
A function that processes a string before comparison. It is called for both the user input and the value it is compared against. This could for example be used to implement accent folding.
mustMatch
default value: 0
If set to 1 (true), the autocompleter will only allow results that are presented by the backend. Note that illegal values result in an empty input box. In the example at the beginning of this documentation, typing "footer" would result in an empty input box.
extraParams
default value: {}
Extra parameters for the backend. If you were to specify { bar:4 }, the autocompleter would call my_autocomplete_backend.php?q=foo&bar=4 (assuming the input box contains "foo").
selectFirst
default value: false
If this is set to true, the first autocomplete value will be automatically selected.
selectOnly (currently not working)
default value: false
If this is set to true, and there is only one autocomplete when the user hits tab/return, it will be selected. This overrides selectFirst.
showResult
default value: none
A JavaScript funcion that can provide advanced markup for an item. For each row of results, this function will be called. The returned value will be displayed inside an LI element in the results list. The function can take up to 2 arguments. The first argument will be the autocompleted text, the second an array of all cells that the backend specified.
showResult: function(value, data) { return '<span style="color:red">' + value + '</span>';}
onItemSelect
default value: none
A JavaScript funcion that will be called when an item is selected. The function can take up to 2 arguments. The first argument will be the autocompleted text, the second an array of all cells that the backend specified.
onItemSelect: function(item) { var text = 'You selected <b>' + item.value + '</b>'; if (item.data.length) { text += ' <i>' + item.data.join(', ') + '</i>'; } $("#last_selected").html(text);}
- Jquery autocomplete options
- jquery.autocomplete.js--options参数介绍
- Jquery autocomplete
- Jquery autocomplete
- jQuery Autocomplete
- jquery.autocomplete
- jquery.autocomplete
- Jquery autocomplete
- Jquery autocomplete
- Jquery autocomplete
- jQuery Autocomplete
- jQuery.AutoComplete
- jquery.autocomplete
- JQuery Autocomplete
- jquery.autocomplete
- Jquery autocomplete
- Jquery Autocomplete
- jquery-autocomplete
- 内核中调用spi接口
- 让Tomcat支持中文路径和中文文件名
- class_create() device_create()
- php 各种进制转换
- 数据库迁移及及区别(Oracle,MySQL,SQLServer)
- Jquery autocomplete options
- 全排列
- android 中的编译选项的对应关系
- 国内外黑客大会资料下载
- 第十六周实验报告2
- csdn 现在到处充斥着n天搞定派的文章, 氛围如此的浮躁
- html5学习笔记之五(扩展图形标记)
- 超好懂的PXE+Kickstart批量安装CentOS6.2教程(山寨版)
- ios后台执行任务详解