[Cubicweb] RestrictedSuggestField: way to set a timeout

Adrien Di Mascio adrien.dimascio at logilab.fr
Tue Aug 16 10:58:33 CEST 2011


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.


-- 
Adrien Di Mascio - LOGILAB, Paris (France).
Tél: 01.45.32.03.12
Formations - http://www.logilab.fr/formations
Développements - http://www.logilab.fr/services
Gestion de connaissances - http://www.cubicweb.org/



More information about the Cubicweb mailing list