* tanguyr wrote (12/01/07 14:35): > Brilliant! > > thanks vey much. I had worked out a hack using a closure, but this (no > pun intended) is *much* more elegant.
This much more elegant thing is still a closure. The reason your closure looks like a hack in comparison to this elegant solution is that the prototype author(s) just do it a bit better :-) I find this is often the case when comparing my code to Prototype code. > > Thanks again Nicolas. > > Regards, > /t > > On 1/12/07, Nicolas Terray <[EMAIL PROTECTED]> wrote: >> >> On 1/12/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> > Here's the problem: the value of "this."in the callback handler is not >> > the same as the value of "this."in the other methods of my object - it >> > looks to me like the value has been "hijacked" and now refers to the >> > ajax request? >> > >> >> Hi, >> >> Please try to replace this line : >> > onComplete:this.ajaxCallBackHandler, >> by this one : >> > onComplete:this.ajaxCallBackHandler.bind(this), >> >> HTH, >> Nicolas Terray >> >> > >> > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
