I've got this rows object as the source of an autocomplete function:

rows = db(query).select(db.vtx_vertex.name, left=left, distinct=True, 
orderby=db.vtx_vertex.name).as_list()
result = [r['name'] for r in rows]
return response.json(result)


This is the autocomplete I'd like to use::
https://www.devbridge.com/sourcery/components/jquery-autocomplete/#


It returns this:

0:    "first option"
1:    "second option"
2:    "third option"

What I need it to return is this:

"suggestions": [
        { "value": "United Arab Emirates", "data": "AE" },
        { "value": "United Kingdom",       "data": "UK" },
        { "value": "United States",        "data": "US" }
    ]


Or this:

"suggestions": ["United Arab Emirates", "United Kingdom", "United States"]


Anyone using this js or knowing how to format the json output correctly?



Kind regards,

Annet




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/727bb0a3-b683-4b90-a6c2-eccaf4372b9co%40googlegroups.com.

Reply via email to