Yep, this should be documented.
Same "misunderstandings" usually happen when delaying/deferring or
currying "methodized" element methods:
document.fire.delay(1, 'foo:bar'); // fails
document.fire.bind(document).delay(1, 'foo:bar'); // works
In this particular case, the "problem" is in #methodize method, which
does "lazy" context binding - method is invoked as "this.<method>"
rather than "element.<method>". One of the solutions would be to
perform "early" binding, forcing methods to be called within element's
context. All methodized element's methods could then be used in any
context.
- kangax
On May 16, 12:04 pm, "Richard Quadling" <[EMAIL PROTECTED]>
wrote:
> Hi.
>
> I have a form which allows a 4 digit number. The number relates to a
> file on the server.
>
> I am able to delay the AJAX trigger by holding onto the result of delay() ...
>
> spoolNumberKeyPress : function(ev)
> {
> if (!isNull(this.o_Delay))
> {
> window.clearTimeout(this.o_Delay);
> }
> this.o_Delay = this.submitSpoolNumber.delay(1);
> },
>
> but in this.submitSpoolNumber(), this isn't correct. I tried ...
>
> this.o_Delay = this.submitSpoolNumber.delay(1).bind(this);
>
> but that didn't work as the return of delay is a bindable type.
>
> I used ...
>
> this.o_Delay = this.submitSpoolNumber.bind(this).delay(1);
>
> and that seemed to be working.
>
> Have I got it right?
>
> If so, can this sort of thing be added to the documentation as an example?
>
> Kind regards,
>
> Richard Quadling
> --
> -----
> Richard Quadling
> Zend Certified Engineer :http://zend.com/zce.php?c=ZEND002498&r=213474731
> "Standing on the shoulders of some very clever giants!"
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---