> > is it possible to have the query in sqlform.autocomplete.widgets? >> *e.g. no error occured but the result is not expected* >> table.customer.widget = SQLFORM.widgets.autocomplete(request, >> db.customer.keywords, id_field = db.customer.id, db = >> db(db.customer.keywords.contains(request) ) ) >> > > this should work. What you mean by result is not expected? >
the autocomplete didn't work at all, not shown any suggestion even i input with full customer name e.g. customer name : customer normal work : type cu (show suggestion) result is not expected : type custom (not show any suggestion) > > >> >> *e.g. an error occured* >> table.customer.widget = SQLFORM.widgets.autocomplete(request, >> db.customer.keywords, id_field = db.customer.id, db = >> db(db.customer.keywords.contains(r) for r in request) ) >> error : >> > > This could be > > q = reduce(lambda a,b: a|b, [db.customer.keywords.contains(r) for r in > request]) > widget = SQLFORM.widgets.autocomplete(request, db.customer.keywords, > id_field = db.customer.id, db = db(q)) > > But I against using the autocomplete this way. Accessing the database > every time you use the autocomplete is a big bottle neck. The best way it > compile a cached dictionary of ids and corresponding words and than use the > cached list instead of the db. > any example how to accomplished it (compile a cached dictionary of ids and corresponding words and than use the cached list) with web2py? thanks and best regards, stifan -- 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]. For more options, visit https://groups.google.com/d/optout.

