Lazy initialize data and reset data

Jerry's Avatar

Jerry

06 Apr, 2010 01:21 AM

It's a great plugin. Can you provide a way such that I can set the data after initialization? The reason is that I don't want the plugin to query the server on every keystroke, and I want to have AJAX update that updates the data every X minutes. It would be good if I can initialize the plugin using empty data and then use AJAX to fetch the data after the page is loaded completely. This would allow me to create the superfast autocomplete like the one on GMail

  1. Support Staff 1 Posted by Drew Wilson on 06 Apr, 2010 01:44 AM

    Drew Wilson's Avatar

    This will be in on the next release. Thanks!
    Drew

  2. 2 Posted by Jerry on 06 Apr, 2010 03:38 AM

    Jerry's Avatar

    Drew, Thanks for the quick reply. It would be also nice if this plugin works with Rails since Rails is very sensitive with the input element name and id. May be you can consider allowing user to pass in a hidden input element which will be used for holding the final value or even better if the final hidden input uses the same ID and name from the original input (and change the ID and name on that).

    No hurry but when do you expect the next release will come out? Is there anyway we can contribute? I tried to do search on GitHub but I could not find this project.

  3. 3 Posted by Jerry on 06 Apr, 2010 06:44 PM

    Jerry's Avatar

    Hi Drew, I extended your library for the following things:
    1. New option "asHtmlName" which will be used for the hidden value
    2. If the original input has an ID or Name, they will be used on the hidden value, it fixes the Rails issue, esp when the form is representing an object
    3. If data is a function, it will involve the function to retrieve the data. In that way, I can create my own retrieve function.

    The modified file is attached.

  4. 4 Posted by Jerry on 06 Apr, 2010 11:59 PM

    Jerry's Avatar

    Drew, I monkey-patched 3 more things for the library.
    1. If I use "preFill" and I specify "selectedItemProp", it will cause an javascript error. Now it is fixed.
    2. If an item is currently highlighted and hitting tab will select the current highlighted item replacing the current input
    3. Able to paste a list of items to the input box

    Hope this helps.

  5. Support Staff 5 Posted by Drew Wilson on 17 May, 2010 10:05 PM

    Drew Wilson's Avatar

    i've added these to the new version. thanks so much for all your work on these!!!!

    however, i did not ad the following, because i think it is more of a specialized behavior and not something that would be natural or expect by the average user:
    "If an item is currently highlighted and hitting tab will select the current highlighted item replacing the current input"

    thanks again Jerry!
    drew

  6. Drew Wilson closed this discussion on 17 May, 2010 10:05 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac