Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] Use one instance of YUI autocomplete for multiple text inputs

Expand Messages
  • Eric Miraglia
    Jason, Each AutoComplete instance is linked to specific DOM elements and listens for changes on those elements. Without rearchititecting AutoComplete, I
    Message 1 of 2 , Feb 1, 2007

      Each AutoComplete instance is linked to specific DOM elements and listens for changes on those elements.  Without rearchititecting AutoComplete, I believe it would be difficult to reuse your AC instances (the component owner may correct me on this, but I suspect not.)

      If your DataSource is configured identically across each text field, though, that part should be reusable and should benefit from any caching that might be going on.

      I would work with multiple AutoComplete instances and a single DataSource unless you're noticing real performance problems.  In that case, you might want to consider instantiating AutoComplete on focus of the text field and destroying each instance on blur while retaining the persistent shared DataSource instance.


      Eric Miraglia
      Yahoo! User Interface Library

      On Feb 1, 2007, at 11:07 PM, Jason Lustig wrote:

      Hi everyone

      I am a Javascript programmer working on a new site based on YUI, and
      for part of our interface we are using a lot of autocomplete. There
      are numerous text fields, one after the other, each of which hook into
      the same backend fo the autocomplete, like this:

      [========] <-- Each use autocomplete, with same source

      Now I know that I can create an autocomplete instance for each text
      field, but that is in a lot of ways a waste of resources. I know that
      for YUI panels, I can set the "context" of the panel to different
      elements on the page, enabling me to basically use a single Panel
      instance for multiple uses. Is it possible to do a similar
      customization on the Autocomplete widget?

      Thanks very much

    Your message has been successfully submitted and would be delivered to recipients shortly.