{"action":"created","issue":{"url":"https://api.github.com/repos/devbridge/jQuery-Autocomplete/issues/119","labels_url":"https://api.github.com/repos/devbridge/jQuery-Autocomplete/issues/119/labels{/name}","comments_url":"https://api.github.com/repos/devbridge/jQuery-Autocomplete/issues/119/comments","events_url":"https://api.github.com/repos/devbridge/jQuery-Autocomplete/issues/119/events","html_url":"https://github.com/devbridge/jQuery-Autocomplete/pull/119","id":21076727,"number":119,"title":"Autocomplete dynamic lookup feature ","user":{"login":"frontmesh","id":738755,"avatar_url":"https://avatars.githubusercontent.com/u/738755?v=3","gravatar_id":"","url":"https://api.github.com/users/frontmesh","html_url":"https://github.com/frontmesh","followers_url":"https://api.github.com/users/frontmesh/followers","following_url":"https://api.github.com/users/frontmesh/following{/other_user}","gists_url":"https://api.github.com/users/frontmesh/gists{/gist_id}","starred_url":"https://api.github.com/users/frontmesh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frontmesh/subscriptions","organizations_url":"https://api.github.com/users/frontmesh/orgs","repos_url":"https://api.github.com/users/frontmesh/repos","events_url":"https://api.github.com/users/frontmesh/events{/privacy}","received_events_url":"https://api.github.com/users/frontmesh/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2013-10-16T12:27:35Z","updated_at":"2015-06-07T16:25:09Z","closed_at":"2015-06-07T16:25:09Z","pull_request":{"url":"https://api.github.com/repos/devbridge/jQuery-Autocomplete/pulls/119","html_url":"https://github.com/devbridge/jQuery-Autocomplete/pull/119","diff_url":"https://github.com/devbridge/jQuery-Autocomplete/pull/119.diff","patch_url":"https://github.com/devbridge/jQuery-Autocomplete/pull/119.patch"},"body":"I have added a  very valuable feature that I borrowed idea from jQueryUI autocomplete widget.\r\nNow, \"lookup\" option is able to take a function as a value for example: \r\n\r\nfunction( value, response ) {\r\n// here goes some code and calculations\r\n\r\n// update lookup data \r\nresponse(myAutoCompleteData);\r\n}\r\nas lookup function gets fired on every value change. \r\n\r\nThis is very useful when you need to work with dynamic,live binded local autocomplete data / collections and other APIs such as Google Maps etc.. \r\n\r\nIf you need anything else for this feature to get merged other than unit test I had added, just tell me and I'll be happy to add.\r\nIf this doesn't get merged, anyone else needing this can clone my forked repo. \r\n"},"comment":{"url":"https://api.github.com/repos/devbridge/jQuery-Autocomplete/issues/comments/109768382","html_url":"https://github.com/devbridge/jQuery-Autocomplete/pull/119#issuecomment-109768382","issue_url":"https://api.github.com/repos/devbridge/jQuery-Autocomplete/issues/119","id":109768382,"user":{"login":"tkirda","id":282935,"avatar_url":"https://avatars.githubusercontent.com/u/282935?v=3","gravatar_id":"","url":"https://api.github.com/users/tkirda","html_url":"https://github.com/tkirda","followers_url":"https://api.github.com/users/tkirda/followers","following_url":"https://api.github.com/users/tkirda/following{/other_user}","gists_url":"https://api.github.com/users/tkirda/gists{/gist_id}","starred_url":"https://api.github.com/users/tkirda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tkirda/subscriptions","organizations_url":"https://api.github.com/users/tkirda/orgs","repos_url":"https://api.github.com/users/tkirda/repos","events_url":"https://api.github.com/users/tkirda/events{/privacy}","received_events_url":"https://api.github.com/users/tkirda/received_events","type":"User","site_admin":false},"created_at":"2015-06-07T16:25:09Z","updated_at":"2015-06-07T16:25:09Z","body":"This has been implemented already. From the docs:\r\n\r\n    $('#autocomplete').autocomplete({\r\n        lookup: function (query, done) {\r\n            // Do ajax call or lookup locally, when done,\r\n            // call the callback and pass your results:\r\n            var result = {\r\n                suggestions: [\r\n                    { \"value\": \"United Arab Emirates\", \"data\": \"AE\" },\r\n                    { \"value\": \"United Kingdom\",       \"data\": \"UK\" },\r\n                    { \"value\": \"United States\",        \"data\": \"US\" }\r\n                ]\r\n            };\r\n\r\n            done(result);\r\n        },\r\n        onSelect: function (suggestion) {\r\n            alert('You selected: ' + suggestion.value + ', ' + suggestion.data);\r\n        }\r\n    });\r\n"}}