kristopher / autocompleter_jsonsearch
- Source
- Commits
- Network (1)
- Issues (0)
- Graphs
-
Branch:
master
README.textile
Autocompleter JSONSearch
Scriptaculous Autocompleter.Local implementation using the JSONSearch library.
Example
new Autocompleter.JSONSearch(id_of_text_field, id_of_div_to_populate, json_object, {
search_options: {
case_sensitive: false,
limit: 10,
offset: 0,
fields: {
name: 'prefix',
category: 'infix'
},
ranks: {
name: 1,
category: 0 // Default is 0
}
},
format_options: {
order: ['name', 'category'],
select: 'name'
}
})
Search Methods
| Type | Description |
|---|---|
| prefix | Matches from the beginning of the string. |
| infix | Matches anywhere in the string. |
| exact | Matches the whole string. |
| word | Matches a whole word. |
| word_prefix | Matches from the beginning of a word. |
Search Options
| Option | Default Value | Description |
|---|---|---|
| case_sensitive | false | case sensitivity when autocompleting. |
| limit | 10 | number of results to display. |
| offset | 0 | amount to offset the results. |
| fields | none | object containing the property names to search as the keys and the desired search method as their values. |
| ranks | 0 | object containing the property names and their desired ranks. |
Format Options
| Option | Default Value | Description |
|---|---|---|
| order | none | order that the results will be displayed. |
| select | all of the results text | property that will be used to populate the input. |
Dependancies
Building
rake dist
Running The Specs
rake spec
Todo
Better Documentation
Testing in something other than Firefox 3
Demo

