On Friday 22 July 2005 01:05, Jack Christensen wrote:> The auto-complete box seems to delay until the user stops typing to
> pop up the complete box. I really prefer the box to pop up as the
> user types like Google Suggest. I found that changing line 83 of
> controls.js from
>
> this.options.frequency = this.options.frequency || 0.4;
> to
> this.options.frequency = this.options.frequency || 0.01;
>
> removes the delay. I''m assuming this causes it to hit the server
much
> more often, but that''s no problem in my situation.
Frequency is a bit of a misnomer here (and the indentation in the code
where it''s used is confusing). The value is used as a timeout to
determine when the user has stopped/paused typing. When you set it very
small, effectively the tiny delay between keypresses is considered as a
pause. As the JavaScript code checks if the field has been changed, at
worst you''ll get one AJAX request per keypress.
> It seems the
> proper way would be to pass in the frequency param in the options. Is
> there someway to do that from Rails? And also, aside from more hits
> on the server is there some reason for that delay? It feels MUCH
> better without it.
I haven''t tested it, but this small change in javascript_helper.rb
might
just do it
def auto_complete_field(field_id, options = {})
# ...
js_options = {}
js_options[:frequence] = options[:frequency].to_s if
options[:frequency]
# ...
end
Michael
--
Michael Schuerig This is not a false alarm
mailto:michael-q5aiKMLteq4b1SvskN2V4Q@public.gmane.org
This is not a test
http://www.schuerig.de/michael/ --Rush, Red Tide