简体   繁体   中英

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 .

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM