It seems like onCreate only gets called like so in prototype:
Ajax.Responders.dispatch('onCreate', this, this.transport);

In other words, only the global responders will get it. 

I'm with you though in wanting a reliable onCreate to happen before
looking at the readystate events.

I've been using onLoading for awhile, but I'm testing right now with a
local webserver and can actually reproduce the race condition whereby
onLoading gets triggered after onComplete by sticking console.debug(
event) on line 765 of prototype.js.

What is anyone else doing? I'm thinking of just adding a similar line of
code for onCreate like onComplete so that the instance of the
AjaxRequest can name it's own onCreate and the responders will still get
called. But I'd of course rather not edit prototype.js.
-l

Alex Duffield in message [Rails-spinoffs] onCreate not getting triggered. (Fri, 
06/16 10:32):

> I am trying to get a loader to display during ajax requests, but the  
> "onCreate" is not getting triggered. The onComplete does.
> 
> 
> function loadComponent(section){
>       values = arguments[1]
>       pars = $H(values).toQueryString()
>       pars = "section="+section+"&"+pars
>       var url = '/internal/ajax/requests.php';
>       
>       var ComponentLoader = new Ajax.Updater('maincontent', url, {
>                       asynchronous:true,
>                       onCreate: function() { loadingRequest('mc_loader', 
>                       'maincontent'); },
>                       onComplete: function() { 
>                       completedRequest('mc_loader',  'maincontent'); },
>                       method: 'post',
>                       parameters: pars,
>                       evalScripts: true });
> }
> 
> function loadingRequest(loader, target)
> {
>    alert("request started");
>    new Effect.Appear($(loader), {duration: 0.5});
>    $(target).style.display = "none";
> }
> 
> function completedRequest(loader, target)
> {
>    alert("request Done");
>   new Effect.Fade($(loader), {duration: 0.5});
>    new Effect.BlindDown($(target));
> }
> 
> Can any one see what I am doing wrong?
> 
> ______________________________________________________________________
> Alex Duffield . Principal . InControl Solutions . http:// 
> www.incontrolsolutions.com
> 
> 
> 

> _______________________________________________
> Rails-spinoffs mailing list
> [email protected]
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs


-- 

Lindsey Simon
[EMAIL PROTECTED]
Key fingerprint = C6A9 B9D9 677E A631 3E7F  43BF 5E2F 77F1 A33C B117
Public Key: http://www.commoner.com/pubkey.asc
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs

Reply via email to