On Tue, Dec 16, 2008 at 11:52 AM, googlysmiles <[email protected]> wrote: > > Hi, I have been banging my head on this for a while, and still have > problem with this call so need some of your professional help here to > get to the bottom of this quickly - > myService.getEventsFeed(queryArr[queryIdxStr], eventCallback, > handleError); > > which is called from getEventsByFeed func, and invoked upon 'onclick' > as defined in calendarCallback func. (some code omitted in '...' for > simplicity). Please let me know if clarification is needed. > > I got no error msg back and queryArr looks good in Firebug. > eventCallback was not called either. Can you please help me to > understand quickly what is going on or going wrong with the code > spinets below? > THANKS MUCH!! > -gs > ======================== > var myService; > var scope = "http://www.google.com/calendar/feeds/"; > // The default "allcalendars" feed is used to retrieve a list of all > // calendars (primary, secondary and subscribed) of the logged-in user > var feedUri = 'http://www.google.com/calendar/feeds/default/ > allcalendars/full'; //allcalendars > var queryArr = new Object(); > google.load("gdata", "1.5"); //1.s stable > google.setOnLoadCallback(initialize_googlecalendar); > > function initialize_googlecalendar() > { > var bodyStuff; > myService = new google.gdata.calendar.CalendarService('ourcalsvs'); > > if (!google.accounts.user.checkLogin(scope)) > { > ... //handle login > } > else //already logged in, so get feed > { > // Submit the request using the calendar service object > getCalendarsByFeed(feedUri); > > bodyStuff = Builder.node('div',{id:'beltContent', > className:'scrollBelt'},[ > > //Builder.node('div',{className:'stuffText'},'My Calendars:') > ]); > document.getElementById('bodyContent').appendChild(bodyStuff); > } > } > > > // The callback method that will be called when getAllCalendarsFeed() > returns feed data > var calendarCallback = function(result) { > > // Obtain the array of CalendarEntry > var entries = result.feed.entry; > var bodyStuff; > > //clear up beltContent div > var p = document.getElementById('beltContent'); > while (p.firstChild) > p.removeChild(p.firstChild); > > for (var i = 0; i < entries.length; i++) { > var calendarEntry = entries[i]; > var calendarTitle = calendarEntry.getTitle().getText(); > var calendarFeed = calendarEntry.getLinks()[0].getHref();//this > will give you the feedUri for each calendar > var calendarColor = calendarEntry.getColor().getValue(); //a > string value of hex color > > // Create a CalendarEventQuery, and specify that this query is > applied toward the calendarFeed retrieved above > queryArr['\''+i+'\''] = new > google.gdata.calendar.CalendarEventQuery(calendarFeed); > // Create and set the minimum and maximum start time for the date > query > var startMin = google.gdata.DateTime.fromIso8601 > ('2008-12-07T00:00:00.000-08:00'); > var startMax = google.gdata.DateTime.fromIso8601 > ('2008-12-13T00:00:00.000-08:00'); > queryArr['\''+i+'\''].setMinimumStartTime(startMin); > queryArr['\''+i+'\''].setMaximumStartTime(startMax); > > bodyStuff = Builder.node('div',{id:'stuff', className:'stuff'},[ > Builder.node('div',{id:('calendarDiv'+i), > style:'cursor: pointer; cursor: hand', > onclick:'getEventsByFeed > (\'' + i + '\')'}, //quoted index as queryIdxStr to global queryArr > 'My calendar no.' + (i+1) + ': ' + calendarTitle) > ]); > > document.getElementById('beltContent').appendChild(bodyStuff); > document.getElementById('calendarDiv'+i).style.background = > calendarColor; > } > } > > function getCalendarsByFeed(feed) > { > // Submit the request using the calendar service object > myService.getAllCalendarsFeed(feed, calendarCallback, handleError); > } > > // The calendar callback method that will be called when > getAllCalendarsFeed() returns feed data > var eventCallback = function(result) { > > // Obtain the array of eventEntry per Calendar > var entries = result.feed.entry; > var bodyStuff; > //...more code here (omitted in this post) > } > > function getEventsByFeed(queryIdxStr) > { > // Submit the request using the calendar service object > myService.getEventsFeed(queryArr[queryIdxStr], eventCallback, > handleError); > } > > // Error handler to be invoked when getAllCalendarsFeed() produces an > error > var handleError = function(error) { > alert('handleError function: '+error); > }
Googlysmiles, I don't see anything obviously wrong with the code above. Can you post an HTML page on a server somewhere so that I can try running this from my end? -- Trevor Johns --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
