On Nov 8, 2015, at 1:01 PM, Deepak Sharma <[email protected]> wrote:
> On Sun, Nov 8, 2015 at 4:29 PM, Anand Meyyappan <[email protected]> > wrote: >> Hi Deepak, >> >> Generally I prefer chosen.js for static select list. It works out of the >> box simply by adding 'chosen-select' class to select tag. If your list is >> massivly big ajax-chosen.js is best choice. You can filer select result by >> sending search query to server when user start typing on the text box. >> >> https://harvesthq.github.io/chosen/ >> https://github.com/meltingice/ajax-chosen > > Actually, in my app > > <option> field = number of patient added > > Means as much as patient added, list gain it's size according to that > so, it seems 'ajax-chosen' works great for me. > > Right now I'm playing with 'chosen' only. I'm facing little obstacle > in it, although it works like a charm but in order to work it properly > I have to refresh my page only then it come into effect. Else, if I > click on button and move to 'vital/new.html.erb' page it show simple > text field, once I refresh my page then it comes into effect. Any idea > what's happing. > > I have followed this : https://github.com/tsechingho/chosen-rails > >> There is also typeahead-rails gem. It is also based on js solution which I >> haven't tried but worth for you to look at. >> >> https://github.com/torbjon/typeahead-rails > > Surely, I'll check this out once I grab a hold on chosen. You're running into the usual conflict with Turbolinks. Instead of using $(document).ready(...) (jquery) or document.on('dom:loaded', ...) (prototype), you have to listen for a different event in order to start your script: $(document).on('page:change', ...) replaces $(document).ready(...) in jQuery, and document.on('page:change', ...) does the same in Prototype. This is all because with Turbolinks, the outermost page loads only once, and never again unless something really disruptive happens to cause a hard reload of the browser. So the usual dom load event only fires once, and any updates to the page don't register with your JavaScript code. Walter > > > -- > Cheers! > > Deepak Kumar Sharma > Guru Nanak Dev Engineering College > India! > > Blog: http://deekysharma.wordpress.com > > -- > 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/CALDHwN6n3edfginJV7DHhP2v_FCtq%3DB72wdAWUDrvQvMHyaD6Q%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. -- 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/4BFC775F-C537-4AD0-BB82-89D828A3B0FE%40wdstudio.com. For more options, visit https://groups.google.com/d/optout.

