Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Suggestion: Add a refresh option #35

Closed
charliebecker opened this issue Sep 15, 2012 · 2 comments
Closed

Suggestion: Add a refresh option #35

charliebecker opened this issue Sep 15, 2012 · 2 comments

Comments

@charliebecker
Copy link

Thank you for this plugin by the way, it's very useful.

I'm using socket.io and node.js. I have it set up so that with each keystroke, I make a request, and later when I receive that request, I update the autocomplete list. However, it doesn't immediately update the autocomplete list, instead I need to wait until the next keystroke before the new items are shown.

Or maybe there's another way for me to do this? Right now I'm using an array for my autocomplete source.

Thanks!

Charlie

@commadelimited
Copy link
Owner

Charlie...

When the keyup event fires, autoComplete performs an AJAX call. You should be able to inspect this call (and it's result) using Dev Tools or Firebug. What are they telling you?

@charliebecker
Copy link
Author

Andy,

I realize I probably didn't give enough info. I'm not using the ajax mechanism of autoComplete because of socket.io. I'm currently binding to a keypress of #searchField and using socket.emit to send that info to the server. I then have a function that receives a response from the server (socket.on) that then updates the suggestions array that I use for the source data for autoComplete.

When I update this array, it does not automatically update the autoComplete list. I figured a refresh call could be used to update the list after I receive this reply.

I tried modifying the autoComplete code by adding the following to the methods array:

    // Refresh list -- Added by Charlie
    refresh: function() {
        handleInput();
    },

But it doesn't get past the if(settings) test in the handleInput function. Am I going down the right track?

Thanks!

Charlie

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants