Forums

Google Calendar Widget
Complete the last day shown before stopping (1 post)

  1. peejay
    Member
    Posted 1 year ago #

    The number of entries read from the Google Calendar feed is set by maxResults. When the last day shown has several entries, this may well lead to an incomplete list of entries for that day.

    I created a workaround where I increase maxResults with ExtraResults (a global variable I added) before getting the feed, and check in 'if (dateString != prevDateString)' whether the counter is greater than the original maxResults. If so, I break out of the for-loop:

    for (var i = 0; i < len; i++)
       {
       //Some code not shown here
       if (dateString != prevDateString) {
          // Append the previous list of events to the widget
          if (eventList != null) {
             eventDiv.appendChild(eventList);
          }
    
          //ADDED BY ME: begin
          //Exit for-loop when starting a new day, if enough events are shown
          if (i > maxResults - ExtraResults){
             break
          }
          //ADDED BY ME: end
    
          // Create a date div element

    This satisfied my needs; but probably you can come up with a more elegant solution.
    It may also be part of a solution for the "Max days rather than max results?" wish.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic