grmmph
grmmph

Reputation: 781

fullCalendar.js: Show events by selected dates?

I'm using fullCalendar 1.6.1 and fetching events from google calendar with gcal. I'm trying to fetch event information for selected dates to be shown on a separated div.

select: function (startDate, endDate, allDay, jsEvent, view) {
        $('.tasksDiv').text(/* Events' info here*/) }

So basically I have a calendarDiv and a tasksDiv, I want to show all the events in the selected(user triggered) dates on the tasksDiv.

Upvotes: 0

Views: 1419

Answers (1)

grmmph
grmmph

Reputation: 781

Okay. For some reason I thought fullCalendar.js has a built-in way to do it, but here is my solution:

select: function (startDate, endDate, allDay, jsEvent, view) {
    var pulledEvents = $('#calendar').fullCalendar('clientEvents');
    for(var i=0; i<pulledEvents.length; i++) {
      if(pulledEvents[i].start.toString() == startDate.toString()){
        $('.tasksDiv').append(pulledEvents[i].title)
      } 
    };
}

So clientEvent calls for all calendar's events, then the loop looks for the the date match. it wouldn't work if you don't convert pulledEvents to a string to fit the selcted's startDate.

Upvotes: 1

Related Questions