|
I suggest avoiding use of setTimeout to get around code ordering issues
at all costs. It is confusing for the coder, and it is not reliable..
i.e. if someone had a *really* slow computer or you change the code
later on it could get really hairy.. Either take a step back and
examine how you could do it deterministically, or better yet, don't
replace the element since it isn't necessary. I'm glad you found the DoubleCombo class useful. :) Colin Andrew McCafferty wrote: Thanks Colin - that's just what I'm looking for. Incidently, I've just got the code I posted above working - albeit with a slight hack. Basically I can use the ajax OnComplete event to fire off a function outside my class that attaches the second event. This was still a bit patchy in that sometimes the DOM ID of the second select was available, sometimes it wasn't. A setTimeout() with a value of '10' *seems* to give the new select enough time to render and become available to the $() utility function.The DoubleCombo script is nicer though... Cheers, Andrew On 16 Mar, 06:48, Colin Mollenhour <[EMAIL PROTECTED]> wrote:Check this out, I think it'll make things much easier for you:http://colin.mollenhour.com/doublecombo/index.html Instead of recreating the element it just refills it so there is no need to re-attach events, just one time will be enough. Colin Andrew McCafferty wrote: --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~--- |
