I think the class for autocomplete is pretty compact and self contained.
So, you can just copy the class in your app somewhere in models if you need
from many differents controllers or in the controller where you need it
instead, rename it and change all what you want then.

I had make a integration of the autocomplete widget and the select or add
option (web2py slice) and I did just that.

I have to make a slice about that and redo the integration with the new
version of the autocomplete widget because it have been changed since I did
my own autocomplete select or add option.


Richard

On Wed, Oct 3, 2012 at 10:23 AM, Mike <m.she...@gmail.com> wrote:

> The autocomplete box takes too long to disappear when it is no longer in
> focus. I found the setting for this, it is in gluon/sqlhtml.py :
>
> [inside __call__ for autocomplete, line 597 for web2py 1.99]
>
> attr['_onblur']="jQuery('#%(div_id)s').delay(3000).fadeOut('slow');" % \
>                 dict(div_id=div_id,u='F'+self.keyword)
>
> Obviously I could just change the setting here and that would work but
> that would require maintenance whenever I upgrade web2py later.
>
> In my model, I have this line:
>
> db.t_port_to_jack.jack_id_string.widget = SQLFORM.widgets.autocomplete(
>         request, db.jack_listings.jack_and_bldg, id_field =
> db.jack_listings.id,limitby = (0,10), min_length=1)
>
> What is the recommended way to modify this setting without making changes
> to sqlhtml.py directly? I've been trying to edit the class attr setting
> when creating the db.t_port_to_jack.jack_id_string.widget instance but I'm
> not very adept with Python classes so I didn't get very far.
>
> Thanks in advance!
> Mike
>
> --
>
>
>
>

-- 



Reply via email to