Agarwal, Shyam
2006-Feb-21 16:39 UTC
modify the auto-complete to use the results already retrieved to create the next set of suggestions
Hi everyone, I want to modify the auto-complete to use the results already retrieved to create the next set of suggestions. For example, if the user types ''j'', the ajax request fetches responses for ''j''.Now if the user types ''o'' the input becomes ''jo''. I want to use the results from ''j'' and narrow down the suggestion to ''jo'' instead of sending a fresh request for ''jo'' to server. Any suggestions on how I can do this ? Thanks, Shyam
Jerod Venema
2006-Feb-22 05:26 UTC
Re: modify the auto-complete to use the results already retrieved to create the next set of suggestions
You could certainly cache the results in an array of your own, but the real usefulness of the autocompleter is for large result sets. That is, if you type "j", there could be several hundred results...and only the first (say) 10 results will be returned. Then, as more letters are added, a better search parameter is created, and the next top 10 will be returned. Since you never return all the results, you won''t be able to "cache and search" them in the manner you''re suggesting. Not to say that you CAN''T do what you''re suggesting...but if you have few enough items that you''re able to return all the matches after a single character, perhaps a standard JS array/filtering would work better? -Jerod On 2/21/06, Agarwal, Shyam <shyam-W2hqgAdRMsX2eFz/2MeuCQ@public.gmane.org> wrote:> > Hi everyone, > > I want to modify the auto-complete to use the results already retrieved to > create the next set of suggestions. > > For example, if the user types ''j'', the ajax request fetches responses for > ''j''.Now if the user types ''o'' the input becomes ''jo''. > I want to use the results from ''j'' and narrow down the suggestion to ''jo'' > instead of sending a fresh request for ''jo'' to server. > > Any suggestions on how I can do this ? > > Thanks, > Shyam > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs