Ruby on Rails Friday, June 26, 2015


On Fri, Jun 26, 2015 at 7:52 AM, David Ng <david.ng.hk@gmail.com> 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.

If you use angular, this can be done more elegantly than in JQuery.​

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CALFmRoEHeL1EDZVhvjmPq3-g4fm9051QMPeLpkt2OvvQ0D-qsg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment