Ya ended up going with onLoading as well. At least for now. 

Now my problem is that my server/application is to fast!! (go figure) 

I am displaying my "loading" graphic to the user on the "onLoading" and then hiding it on "onComplete" but the thing just flashes for les than a second and is all but useless. 

Has any one come up with a good solution to only show the loader if the request is taking more than X seconds or something?? 

Thanks.

______________________________________________________________________

Alex Duffield . Principal . InControl Solutions . http://www.incontrolsolutions.com 




On 16-Jun-06, at 12:13 PM, Lindsey Simon wrote:

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 = '';


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


-- 

Lindsey Simon
Key fingerprint = C6A9 B9D9 677E A631 3E7F  43BF 5E2F 77F1 A33C B117
_______________________________________________
Rails-spinoffs mailing list

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

Reply via email to