typeahead.js remote with subset matching
Posted
by
rebelde
on Stack Overflow
See other posts from Stack Overflow
or by rebelde
Published on 2013-10-28T15:50:06Z
Indexed on
2013/10/28
15:53 UTC
Read the original article
Hit count: 216
typeahead.js
Instead of returning to the server after each additional letter is typed, I want it to only go to the server once, get all matching words, and filter the downloaded data after that.
We are having trouble making this work. We are successfully using "remote" to wait until two letters are typed, but we can't get it to stop going to the server as additional letters are typed.
Steps: 1. After two letters are typed, retrieve all matching words that start with those two letters. 2. When a third and additional letters are typed, don't go to the server again, just filter from the previous list that was sent.
An example: "mo" is typed in. All 100 words that start with "mo" are returned. (Only 10 are shown.) "mor" - now with a third letter, we don't go back to the server. We just find the 20 words that match from within the previous set of words.
Can anybody make this work?
In real life (using YUI2), we do this and then go back to the server if somebody types in a space after the word. At that point, we know to retrieve additional words.
Thanks!
© Stack Overflow or respective owner