We have successfully embedded in our website the joint calendar of
multiple organizational public calendars showing training sessions.
But unlike the Map API’s there is no embedded Calendar search control,
so we’re using Javascipt Calendar API’s to provide the search control
and retrieve selected events by time and topic. All works well except
the events come back with source calendar as the primary sort and
event date as the secondary sort, and obviously it would be more
useful the other way round. [why one can have multiple sources in
embedded calendar but not in API event feeds is another question
appearing often]
The problem here is that processing the results within the callback
function works fine for each calendar, but we need to identify the
point at which all callbacks have completed to then re-sort the
results. In effect, there’s a need for for an event listener like an
XMLHTTP status completion code.
The question: is there an approach at this API-level to detect
completion of the multiple getEventsFeed services to do post-
processing of the results? Due to the continuation passing style, loop
ends are no help. Numerous dead ends have been tried – any help
greatly appreciated.
Here’s the gist of the code:
function _run () {
// establish calendar service
var calendarService = new google.gdata.calendar.CalendarService
('xyz');
// loop over each feedUri where calendarURL is array of public
calendar URLs
// and queryParam includes sortedby and time specs.
for ( var i = 0; i < calendarURL.length; i++ {
// define query for each public calendar
var calendarUri = calendarURL [i];
var feedUri = 'http://www.google.com/calendar/feeds/' +
calendarUri + queryParam;
// do query
var query = new google.gdata.calendar.CalendarEventQuery
(feedUri);
// await and process results
var callback = function(results) {
var eventEntries = results.feed.getEntries();
// process/display results .. .
};
var handleError = function(error) {
// display error message
};
calendarService.getEventsFeed(query, callback, handleError);
} /* end for loop*/
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" 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/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---