On 26 June 2015 at 08:43, Ganesh Ranganathan <[email protected]> wrote: > > On Fri, Jun 26, 2015 at 7:52 AM, David Ng <[email protected]> wrote: >> >> I saw some dynamic search pick list, I mean the pick list is updated >> whenever I type one character. DO i have to do it in Javascript ? > > > This can be done with jquery. On the change event of the textbox , make an > ajax call to a action which takes in the typed text and returns a json array > of objects to be populated in the list. In the success handler of the ajax > call, remove all existing elements in the list and add the new ones returned > by the action.
That way will involve a server request for every character typed, since that could easily be several seconds and maybe a lot more this will introduce intolerable delays for the user. For acceptable performance send the complete list to the browser and manage the selection in javascript. Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsjLhKYQ28RrNGjPkf6T8HdiUB6wXonDkz9zR8UGKQ6LA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

