I have my current autocomplete but it doesn't do öäå in a search.  Does
this handle that?
Best Regards,
Jason
On Sat, 2010-02-06 at 12:30 -0800, mdipierro wrote: 
> People say there is some magic in web2py.
> Here is some real magic now in trunk that I am sure you have never
> seen.
> 
> Caveats:
> 0) requires latest trunk (bzr 1603, hg 175:e42b559254f6)
> 1) this is an experiment, not sure it is a good idea
> 2) this is the first function in web2py that REQUIRES jQuery
> 3) works but I am not yet convinced it should stay there
> 4) even if it stays, I am sure the API should stay
> 
> Example:
> 
> ### assume this model
> db.define_table('target',Field('name'))
> if not db(db.target.id>0).count():
>     db.target.insert(name="Klingon")
>     db.target.insert(name="Romulans")
>     db.target.insert(name="Borg")
>     db.target.insert(name="Borg2")
> db.define_table('photon_torpedo',Field('target',db.target))
> 
> ### assume this action in controller default.py
> def launch():
>     db.photon_torpedo.target.represent=lambda target: target.name
>     return dict(new_torpedo=crud.create(db.photon_torpedo),
>                 launched_torpedos=db().select(db.photon_torpedo.ALL))
> 
> So far nothing new.
> 
> Now append to the model or insert at top of controller the following:
> 
> from gluon.sqlhtml import AutocompleteWidget
> db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id)
> 
> No need to define any callback action (there is no callback action!)
> No plugin required (perhaps some optional css to style).
> No js coding required.
> Applies to existing apps, including those that use custom forms.
> 
> Let's see who can figure out how it works!
> 
> Massimo
> 


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to