Hi Anthony,
I am rebuilding an application that uses the jQuery UI autocomplete widget.
In the view I have the following code:
<script type="text/javascript">
$(function() {$("#no_table_name").autocomplete({source: "{{=URL('jquery',
'name_autocomplete')}}", minLength: 2});});
</script>
name_autocomplete is a function in the jquery controller:
def name_autocomplete():
left = [db.app_settings.on(db.vtx_vertex.id==db.app_settings.vertexID)]
rows = db((db.vtx_vertex.name.contains(request.get_vars.term,
case_sensitive=False)) &
((db.vtx_vertex.typeID.belongs(ORGANIZATIONID, IOTHINGID)) |
((db.vtx_vertex.typeID==PERSONID) &
(db.app_settings.viewtypeID>ZEROID) &
(db.app_settings.openID==PUBLIC)))).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)
I'd like to use SQLFORM.widgets.autocomplete(request, db.vtx_vertex.name,
limitby=(0,10), min_length=2, db=db(Filter))
I don't know how to code the filter to give me the same list of values.
Is it possible for Filter to call name_autocomplete() in the jquery
controller.
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/4e85a328-c1de-46df-9b5c-632b865e4e83%40googlegroups.com.