From 03b9786f3f2430772801512ca9e59e6c9f6d1b5d Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Tue, 8 Oct 2013 01:16:07 +0200 Subject: [PATCH] Fix and test callbacks for autocompleters --- public_html/static/js/jquery-autocomplete.js | 2 +- public_html/static/js/openng.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public_html/static/js/jquery-autocomplete.js b/public_html/static/js/jquery-autocomplete.js index 9cfe74f..ed50582 100644 --- a/public_html/static/js/jquery-autocomplete.js +++ b/public_html/static/js/jquery-autocomplete.js @@ -147,7 +147,7 @@ AutoCompleterInstance.prototype._selectCurrent = function() { if(typeof this.callback !== "undefined") { - this.callback(item).apply(this); + this.callback.call(this, item); } else { diff --git a/public_html/static/js/openng.js b/public_html/static/js/openng.js index e909807..908bcc5 100644 --- a/public_html/static/js/openng.js +++ b/public_html/static/js/openng.js @@ -250,7 +250,9 @@ $(function(){ $("#input_search_query").on("input", function(){ if(!$(this).data("attached-autocomplete")) { - $("#input_search_query").autoComplete(autocompleter_search, new SearchCompletionSource($("#input_search_query"))); + $("#input_search_query").autoComplete(autocompleter_search, new SearchCompletionSource($("#input_search_query")), function(data){ + console.log(data); + }); } }); });