Hey,
OK, so what you need to get for this is:
- effects run in parallel by default.
- you should invoke them using "new" to make them work properly.
- putting them in a queue is good, but not good enough: the queueing
mechanism is used to adjust their scheduled start time, it won't handle
the additional Ajax.Updater-induced delay (request/response time)
particularly well.
However, using a 2-limited dedicated queue can help with preventing
issues when another update is request while an update is going on still.
So all you're left with is a rather spewy piece of code, although we can
factor the update code with a function on the side. Try this on for
size (untested, based on SVN):
function updateContents(obj, errorListDOM) {
obj.clear();
obj.appendChild(errorListDOM);
// And let's forego the BR and use proper CSS instead, shall we?
new Effect.BlindDown(obj, { queue: { scope: 'results', limit: 2 }});
}
function updateResults(resultsContainer, errorListDOM) {
resultsContainer = $(resultsContainer);
if (resultsContainer.visible()) {
new Effect.BlindUp(resultsContainer, {
queue: { scope: 'results', limit: 2 },
afterFinish: function() {
updateContents(resultsContainer, errorListDOM);
}
});
} else {
updateContents(resultsContainer, errorListDOM);
}
} // updateResults
In the end, it's pretty much your original code, although with a
dedicated queue, the assurance that the BlindDown occurs after the
update no matter what, and a factored update/blindDown code.
There's not much for it, I'm afraid!
--
Christophe Porteneuve a.k.a. TDD
"[They] did not know it was impossible, so they did it." --Mark Twain
Email: [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---