I think you need to return data with line breaks after it:
one
two
three
internally the autocomplete plugin splits on the pipe. See this:
http://grover.open2space.com/node/190
and this:
http://docs.jquery.com/Plugins/Autocomplete/autocomplete#url_or_dataoptions
"The result must return with one value on each line. The result is
presented in the order the backend sends it. "
- Jack
Gath wrote:
Am using JQuery Autocomplete on my templete, but as i get the results
the Autocomplete only displays one item despite that the results that
are fetched have more that one item. It only shows the first item on
the list!
Example:
if i have a result list with ('python', 'pythonism', 'pythodus')
and on the autocomplete i type 'pyt' it only displays 'python' on the
drop down!
My autocomplete code:
$(document).ready(function(){
$("#tags1").autocomplete("/taglookup/", {
width: 320
});
})
My Ajax Django view that get called;
def tag_lookup(request):
# Default return list
results = []
if request.method == "GET":
if request.GET.has_key(u'q'):
value = request.GET[u'q']
# Ignore queries shorter than length 3
if len(value) > 2:
TI = Tag.objects.filter(name__contains=value)
print TI
results = [ x.name for x in TI]
results = 'one|two|three'
return HttpResponse(results, mimetype='text/plain')
Please note i have hard coded the result for testing purposes! so
anything i type on the autocomplete field, i expect it to display a
drop down list with 'one, two, three' but its only displaying 'one'
Any ideas?
Gath