I recently worked on extending the Prototype Ajax.Updater class by
creating a MultiUpdater.  This is something that can update several
"containers" with a single ajax request.  The purpose is to serve
dashboard-style pages that have multiple sections being fed from
different sources.  This is best suited for situations when the data
required for the dashboard page can be easily collected in a single
HTTP request.

The implementation consists of two parts.  First, there's the
MultiUpdater that looks very similar to the Ajax.Updater.  However,
instead of accepting a single "container" name, it accepts a mapping
of request parameter names to container names.  The second part is a
ResponseMapper that maps the HTTP response to the various containers.
The ResponseMapper follows a Strategy design pattern, allowing the
client to pass in any ResponseMapper they might dream up.

The reason I started working on this was because we had a dashboard-
style page that needed to be initialized via Ajax.  The example was
one where we had documents stored in Alfresco and we wanted to show
lists of documents from various Alfresco "spaces" on a single page.
Alfresco provides a web service API that accepts queries in Lucene
syntax.  So it was easy to write a single Lucene query to retrieve all
the data we needed for page.

Initially, the page was constructed by executing 10+ separate HTTP
requests, each gathering data from a separate Alfresco space.  Now,
the page can gather all of its data in one single HTTP request and one
Alfresco Lucene query.

I've uploaded the file under the name "prototype-ext.js".

Please have a look and comment.  I'm looking for feedback.

Thanks!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" 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/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to