Permalink
Browse files

Added option 'getData', which is a function returning set of data (as…

… opposed to static 'data' option)
  • Loading branch information...
1 parent 536228c commit ca698c14196ce1211cd98ba1317628bb185714ed @SlNPacifist SlNPacifist committed Apr 24, 2012
Showing with 7 additions and 1 deletion.
  1. +3 −0 doc/jquery.autocomplete.txt
  2. +4 −1 src/jquery.autocomplete.js
View
3 doc/jquery.autocomplete.txt
@@ -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 :
=======================
View
5 src/jquery.autocomplete.js
@@ -80,7 +80,8 @@
useDelimiter: false,
delimiterChar: ',',
delimiterKeyCode: 188,
- processData: null
+ processData: null,
+ getData: null
};
/**
@@ -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);

0 comments on commit ca698c1

Please sign in to comment.