[Cubicweb] RestrictedSuggestField: way to set a timeout

Sylvain Thénault sylvain.thenault at logilab.fr
Wed Sep 7 10:52:02 CEST 2011

On 16 August 10:58, Adrien Di Mascio wrote:
> Hi,
> On 16/08/2011 10:19, Alexandre Fayolle wrote:
> >Is there a way to setup a timeout on a RestrictedSuggestField. The original
> >list from which I want some suggestion has several 1000 elements, and the
> >performance hit when the user hits the first keys in the field is way to high.
> >Being able to delay the query a little bit until the user has typed in a few
> >letters and paused would be nice. Is this possible?
> Something like this used[1] to work :
>   from cubicweb.web import uicfg, formwidgets as fw
>   _affk = uicfg.autoform_field_kwargs
>   _affk.tag_subject_of(('Expense', 'spent_for', '*'),
>                        {'widget': fw.LazyRestrictedAutoCompletionWidget(
>               autocomplete_initfunc='get_concerned_by',
>               autocomplete_settings={'limit': 100,
>                                      'delay': 300}),
>                         })
> Notice the 'delay' settings.
> [1] I say "used" because we've switched to jquery.ui.autocomplete
> widget a few months ago and it might not work as well as before.

would you ensure this is in the doc? This is the kind of thing people want.

Sylvain Thénault                               LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure:       http://www.logilab.fr/services
CubicWeb, the semantic web framework:    http://www.cubicweb.org

More information about the Cubicweb mailing list