Skip to content
This repository was archived by the owner on Jul 2, 2018. It is now read-only.

Added option 'getData' #45

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions doc/jquery.autocomplete.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ useDelimiter (default value: false)
comma. For example, you may want to allow the user to enter a comma separated list of values--and
each value will autocomplete without erasing the other delimited values in the input field.

getData (default value: null)
Function which return data to be processed. If several sources are present, then data is fetched
in following order: "data" option, "getData" option call, ajax query to remote url.

More advanced options :
=======================
Expand Down
5 changes: 4 additions & 1 deletion src/jquery.autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@
useDelimiter: false,
delimiterChar: ',',
delimiterKeyCode: 188,
processData: null
processData: null,
getData: null
};

/**
Expand Down Expand Up @@ -536,6 +537,8 @@
processResults([], value);
} else if (this.options.data) {
processResults(this.options.data, value);
} else if (this.options.getData) {
processResults(this.options.getData(), value);
} else {
this.fetchRemoteData(value, function(remoteData) {
processResults(remoteData, value);
Expand Down